from math import gcd

N=int(input())
A=[int(input()) for i 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],A[j],A[k])==1:
                ANS+=1

print(ANS)