from math import gcd n = int(input()) A = [0] * n for i in range(n): A[i] = int(input()) ans = 0 for a in range(n): for b in range(a + 1, n): for c in range(b + 1, n): if gcd(gcd(A[a], A[b], A[c])) == 1: ans += 1 print(ans)