import sys input = sys.stdin.readline from collections import * import random class Fast_factorize: def __init__(self, n): self.p = [-1]*(n+1) for i in range(2, n+1): if self.p[i]==-1: for j in range(i, n+1, i): if self.p[j]==-1: self.p[j] = i def factorize(self, n): res = [] while n>1: res.append(self.p[n]) n //= self.p[n] return res N = int(input()) A = list(map(int, input().split())) ff = Fast_factorize(10**6+10) x = random.sample(range(10**10, 10**18), 10**6+10) cnt = defaultdict(int) cnt[0] = 1 now = 0 ans = 0 for Ai in A: ps = Counter(ff.factorize(Ai)) for k, v in ps.items(): if v%2==1: now ^= x[k] ans += cnt[now] cnt[now] += 1 print(ans)