import math n=int(input()) a=[] for i in range(n): a.append(int(input())) ans=0 for i in range(n): for j in range(i+1,n): for k in range(j+1,n): if math.gcd(a[i],math.gcd(a[j],a[k]))==1: ans+=1 print(ans)