#include #include #include using namespace std; uint64_t xorshift64(uint64_t h) { h ^= h << 13; h ^= h >> 7; h ^= h << 17; return h; } int main() { int N; cin >> N; vector A(N); for(int i = 0; i < N; ++i) { cin >> A[i]; } vector s(N + 1); for(int i = 0; i < N; ++i) { for(int j = 2; j * j <= A[i]; ++j) { while(A[i] % j == 0) { A[i] /= j; s[i + 1] ^= xorshift64(xorshift64(xorshift64(xorshift64(xorshift64(xorshift64(j)))))); } } if(A[i] != 1) { s[i + 1] ^= xorshift64(xorshift64(xorshift64(xorshift64(xorshift64(xorshift64(A[i])))))); } } for(int i = 1; i <= N; ++i) { s[i] ^= s[i - 1]; } sort(s.begin(), s.end()); long long ans = 0; int pre = 0; for(int i = 1; i <= N + 1; ++i) { if(i == N + 1 || s[i] != s[i - 1]) { ans += 1LL * (i - pre) * (i - pre - 1) / 2; pre = i; } } cout << ans << endl; return 0; }