n=int(input()) l=[] for i in range(n): s=int(input()) l.append(s) from itertools import combinations c=list(combinations(l,3)) l2=[] for x in c: x=list(x) l2.append(x) from math import gcd ans=0 for x in l2: if gcd(*x)==1: ans+=1 print(ans)