n = int(input()) a = [int(input()) for _ in range(n)] def gcd(x,y): while True: r = x % y x = y y = r if r == 0: return x count = 0 for i in range(n): for j in range(i+1,n): for k in range(j + 1,n): if gcd(gcd(a[i],a[j]),a[k]) == 1:count += 1 print(count)