#include<cstdio>
#include<vector>
using namespace std;
int GYS(int x, int y){
	if (y == 0)return x;
	else return(GYS(y, x%y));
}
int main(){
	int n;
	vector<int>vec;
	while (scanf("%d", &n) != EOF){
		if (0 == n){
			break;
		}
		for (int i = 0; i < n; i++){
			int m;
			scanf("%d", &m);
			vec.push_back(m);
		}
		int sum=0;
		for (int i = 0; i < n; i++){
			for (int j = i; j < n; j++){
				if (GYS(vec[i], vec[j]) == 1){
					sum++;
				}
			}
		}
		printf("%d\n", sum);
	}
}