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