import sys,random,bisect from collections import deque,defaultdict from heapq import heapify,heappop,heappush from itertools import permutations from math import log,gcd input = lambda :sys.stdin.readline() mi = lambda :map(int,input().split()) li = lambda :list(mi()) M = 10**6 spf = [i for i in range(M+1)] for i in range(2,M+1): if spf[i]==i: for j in range(i,M+1,i): spf[j] = i def factorize(n): res = [] while n!=1: p = spf[n] cnt = 0 while n%p==0: cnt += 1 n //= p if cnt&1: res.append(p) return res N = int(input()) A = [1] + li() mod = 998244353 r = random.randint(2,mod-2) pow_r = [1] * (M+1) for i in range(1,M+1): pow_r[i] = pow_r[i-1] * r % mod dic = {} PS = [0] for i in range(N): tmp_p = factorize(A[i+1]) tmp_PS = PS[-1] for p in tmp_p: if p not in dic: dic[p] = 0 tmp_PS += pow_r[p] * (1-2*dic[p]) % mod tmp_PS %= mod dic[p] = 1 - dic[p] PS.append(tmp_PS) res = 0 PS.sort() val = PS[0] tmp = 1 for i in range(1,N+1): if val==PS[i]: tmp += 1 else: res += tmp * (tmp-1)//2 val = PS[i] tmp = 1 res += tmp * (tmp-1)//2 print(res)