#include using namespace std; #define rep(i,n) for(ll i=0;i=0;i--) #define perl(i,r,l) for(ll i=r-1;i>=l;i--) #define fi first #define se second #define pb push_back #define ins insert #define pqueue(x) priority_queue,greater> #define all(x) (x).begin(),(x).end() #define CST(x) cout<> #define rev(x) reverse(x); using ll=long long; using vl=vector; using vvl=vector>; using pl=pair; using vpl=vector; using vvpl=vector; const ll MOD=1000000007; const ll MOD9=998244353; const int inf=1e9+10; const ll INF=4e17; const ll dy[9]={0,1,-1,0,1,1,-1,-1,0}; const ll dx[9]={1,0,0,-1,1,-1,1,-1,0}; template inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; } template inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; } class osak{ vector res; public: vector prime; osak(long long n){//sieve(n),O(N); res=vector(n); iota(res.begin(), res.end(), 0); for (int i = 2; i*i < n; ++i) { if (res[i] < i) continue; for (int j = i*i; j < n; j += i) if (res[j] == j) res[j] = i; } for(int i = 2; i < n; ++i){ if(res[i]==i)prime.emplace_back(i); } } map factor(int n) { map factor; while (n > 1) { factor[res[n]]++; n /= res[n]; } return factor; } vector divisor(int N){//O(div.size()) map facs=factor(N); vector ret={1}; for(auto p:facs){ ll range=ret.size(); ll now=1; for(int i=0;i 0) { if (n & 1) res = res * a % mod; a = a * a % mod; n >>= 1; } return res; } int main(){ ll n;cin >> n; map mp; mp[{1,1}]++; ll now1=1,now2=1; vl dp(1000010); osak os(1000010); rep(i,n){ ll a;cin >> a; for(auto p:os.factor(a)){ if(p.second&1){ if(dp[p.first]){ dp[p.first]--; now1=now1*modpow(p.first,MOD-2,MOD)%MOD; now2=now2*modpow(p.first,MOD9-2,MOD9)%MOD9; } else{ dp[p.first]++; now1=now1*p.first%MOD; now2=now2*p.first%MOD9; } } } mp[{now1,now2}]++; } ll ans=0; for(auto p:mp){ ans+=p.second*(p.second-1)/2; } cout << ans << endl; }