#include using namespace std; mt19937_64 rng; struct primenumber { vector spf; vectorpura; primenumber(int N) { init(N); } void init(int N) { spf.assign(N+1,0); pura.assign(N+1,0); for(int i = 0; i <= N; i++) { spf[i] = i; } for(int i = 2; i*i <= N; i++) { if(spf[i] == i) { pura[i] = rng()%1001001001001001001; for(int j = i*i; j <= N; j += i) { if(spf[j] == j) { spf[j] = i; } } } } } bool is_prime(long long n) { bool flag = true; if(n == 1) { flag = false; } for(long long i = 2; i*i <= n; i++) { if(n%i == 0) { flag = false; } } return flag; } long long get(int n) { long long m = 0; while(n != 1) { m ^= pura[spf[n]]; n /= spf[n]; } return m; } }; int main() { int n; cin >> n; vectora(n); vectorb(n+1); primenumber zz(1000001); for(int i = 0; i < n; i++) { cin >> a[i]; b[i+1] = b[i]^zz.get(a[i]); } sort(b.begin(),b.end()); long long ans = 0; maptmp; for(int i = 0; i < b.size(); i++) { ans += tmp[b[i]]; tmp[b[i]]++; } cout << ans << endl; }