#include <iostream>
#include <cstdio>

using namespace std;

int n[601];

int GCD(int a, int b) {
  if (b == 0) {
    return a;
  } else {
    return GCD(b, a % b);
  }
}

int main() {
  int num;
  while (scanf("%d", &num) != EOF) {
    int number = 0;
    if (num == 0) {
      break;
    }
    for (int i = 0; i < num; ++i) {
      scanf("%d", &n[i]);
    }
    for (int i = 0; i < num; ++i) {
      for (int j = 0; j < num; ++j) {
        if (n[i] < n[j]) {
          if (GCD(n[i], n[j]) == 1) {
            number++;
          }
        }
      }
    }
    printf("%d\n", number);
  }
  return 0;
}