#include <iostream>
#include "vector"
#include "algorithm"
using namespace std;
int gcd(int a, int b) {
    if (b == 0) return a;
    else return gcd(b, a % b);
}
int main() {
    int n;
    while (cin >> n) { // 注意 while 处理多个 case
        // cout << a + b << endl;
        if (n == 0) break;
        vector<int> integers;
        while (n--) {
            int temp;
            cin >> temp;
            integers.push_back(temp);
        }
        sort(integers.begin(), integers.end());
        int count = 0;
        for (int  i = 0; i < integers.size(); i++) {
            for (int j = i + 1; j < integers.size(); j++) {
                if (gcd(integers[i], integers[j]) == 1) count++;
            }
        }
        cout << count << endl;
    }

}
// 64 位输出请用 printf("%lld")