import sys input = sys.stdin.readline from random import randint from collections import Counter R=[randint(10**15,10**16) for i in range(10**6+5)] # エラトステネスの篩を用いた素因数分解・約数列挙 MAX=2*10**6+10 # 使いたい最大値を指定 # Sieve[i]で、iの最も小さい約数を返す。 Sieve=[i for i in range(MAX)] for i in range(2,MAX): if Sieve[i]!=i: continue for j in range(i,MAX,i): if Sieve[j]==j: Sieve[j]=i # 素因数分解 def fact(x): D=dict() while x!=1: k=Sieve[x] if k in D: D[k]+=1 else: D[k]=1 x//=k return D # 約数列挙 def faclist(x): LIST=[1] while x!=1: k=Sieve[x] count=0 while x%k==0: count+=1 x//=k LIST2=[] for l in LIST: for i in range(1,count+1): LIST2.append(l*k**i) LIST+=LIST2 return LIST n=int(input()) A=list(map(int,input().split())) X=[0] for a in A: L=fact(a) x=0 for l in L: if L[l]%2==1: x^=R[l] X.append(X[-1]^x) C=Counter(X) ANS=0 for c in C: ANS+=C[c]*(C[c]-1)//2 print(ANS)