import itertools, math n = int(input()) a = [int(input()) for i in range(n)] ans = 0 for s in itertools.combinations(a, 3): if math.gcd(math.gcd(s[0], s[1]), s[2]) == 1: ans += 1 print(ans)