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