#include<cstdio> #include<vector> using namespace std; int GDC(int a, int b) { if (b == 0) { return a; } else { return GDC(b, a % b); } } int main() { int n ; vector<int> arr; while (scanf("%d", &n) != EOF) { if (n == 0) { break; } for (int i = 0 ; i < n ; ++i) { int x; scanf("%d", &x); arr.push_back(x); } int len = arr.size(); int count = 0; for (int i = 0 ; i < len - 1; ++i) { for (int j = i + 1 ; j < len ; ++j) { if (GDC(arr[i], arr[j]) == 1) { ++count; } } } printf("%d\n", count); } return 0; }