import math import itertools def gcd(a,b,c): return math.gcd(math.gcd(a,b),c) n=int(input()) l=[int(input()) for _ in [0]*n] x=list(itertools.combinations(l,3)) c=0 for i in x: if gcd(*i)==1: c+=1 print(c)