def gcd(l): l = sorted(l)[::-1] while sum([l[x]%l[-1] for x in range(len(l)-1)]): l[0],l[1] = l[1],l[0] % l[1] l = sorted(l)[::-1] if 0 in l: l.pop(l.index(0)) return min(l) n = int(input()) l = [int(input()) for _ in range(n)] v = 0 for a in range(n-2): for b in range(a+1,n-1): for c in range(b+1,n): v += gcd([l[a],l[b],l[c]]) == 1 print(v)