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