import random from collections import defaultdict MOD = 1788747373638354509 def factor(x: int): res = [] while x % 2 == 0: res.append([2, 0]) while x % 2 == 0: res[-1][1] += 1 x //= 2 y = 3 while y * y <= x: if x % y == 0: res.append([y, 0]) while x % y == 0: res[-1][1] += 1 x //= y y += 2 if x != 1: res.append([x, 1]) return res def solve(): N = int(input()) A = list(map(int, input().split())) M = 10**6 ha = [random.randint(0, MOD-1) for _ in range(M+1)] memo = {} hash_values = [0] * N for i in range(N): if A[i] not in memo: val = 0 for p, e in factor(A[i]): val ^= ha[p] * (e & 1) memo[A[i]] = val hash_values[i] = memo[A[i]] pref = [0] * (N + 1) for i in range(N): pref[i + 1] = pref[i] ^ hash_values[i] ans = 0 mp = defaultdict(int) for i in range(N + 1): ans += mp[pref[i]] mp[pref[i]] += 1 print(ans) if __name__ == "__main__": solve()