from math import gcd n = int(input()) A = [int(input()) for _ in range(n)] ans = 0 for i in range(n): for j in range(i + 1, n): for k in range(j + 1, n): if gcd(A[i], gcd(A[j], A[k])) == 1: ans += 1 print(ans)