import sys input = lambda : sys.stdin.readline().rstrip() write = lambda x: sys.stdout.write(x+"\n"); writef = lambda x: print("{:.12f}".format(x)) debug = lambda x: sys.stderr.write(x+"\n") YES="Yes"; NO="No"; pans = lambda v: print(YES if v else NO) LI = lambda : list(map(int, input().split())) # sys.setrecursionlimit(3*10**5+10) def hurui(n): """線形篩 pl: 素数のリスト mpf: iを割り切る最小の素因数 """ pl = [] mpf = [None]*(n+1) for d in range(2,n+1): if mpf[d] is None: mpf[d] = d pl.append(d) for p in pl: if p*d>n or p>mpf[d]: break mpf[p*d] = p return pl, mpf from collections import defaultdict def factor(num): d = defaultdict(int) if num==1: d.update({1:1}) return d while num>1: d[mpf[num]] += 1 num //= mpf[num] return d def fs(num): f = factor(num) ans = [1] for k,v in f.items(): tmp = [] for i in range(len(ans)): val = 1 for _ in range(v): val *= k ans.append(ans[i]*val) return ans pl, mpf = hurui(10**6+10) n = int(input()) a = list(map(int, input().split())) M = 10**9+7 vs = {} d = {} d[0] = 1 val = 0 s = set() ans = 0 import random def sub(k): if k in vs: return vs[k] vs[k] = random.randint(1,M-1)*k%M return vs[k] for i in range(n): f = factor(a[i]) for k,v in f.items(): if k==1: continue if v%2==1: tmp = sub(k) if k in s: s.remove(k) val -= tmp else: s.add(k) val += tmp val %= M ans += d.get(val, 0) d.setdefault(val, 0) d[val] += 1 print(ans)