#yuki1146 from math import * n=int(input()) a=[] for i in range(n): a.append(int(input())) cnt=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: cnt+=1 print(cnt)