import java.util.Scanner;
import java.util.Arrays;
// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main {
    public static void main(String[] args) {
        // TODO 自动生成的方法存根
        Scanner sc = new Scanner(System.in);
        while (sc.hasNext()) {
            int n = sc.nextInt();
            if (n == 0)break;
            int [] arr = new int[n];
            for (int i = 0; i < arr.length; i++) {
                arr[i] = sc.nextInt();
            }
            Arrays.sort(arr);
            int count = 0;
            for (int i = 0; i < arr.length; i++) {
                for (int j = i + 1; j < arr.length; j++) {
                    if (!hasYinzi(arr[i], arr[j])) {
                        count++;
                    }
                }
            }
            System.out.println(count);
        }
    }
    public static boolean hasYinzi(int x, int y) {
        int t = 0;
        if (x > y) {
            t = x;
            x = y;
            y = t;
        }
        for (int i = 2; i <= x; i++) {
            if (x % i == 0 && y % i == 0)
                return true;
        }
        return false;
    }
}