# coding: utf-8 # Your code here! import math N=int(input()) A=[] for _ in range(N): A.append(int(input())) #print(A) ans=0 for i in range(N-2): for j in range(i+1,N-1): gcd_2=math.gcd(A[i],A[j]) for k in range(j+1,N): gcd_3=math.gcd(gcd_2,A[k]) if gcd_3==1: ans+=1 print(ans)