#include<bits/stdc++.h>
using namespace std;
#define int long long
void sol(){
int n;
cin >> n;
int a[n], ans = 0;
map<int, int> m;
for(int &i:a) cin >> i, m[i]++;
for(int i = 1; i < 1000001; i++) ans += m[i * i] * m[i * i * i];
cout << ans << '\n';
return;
}
signed main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int t = 1;
//cin >> t;
while(t--){
sol();
}
return 0;
}
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKI2RlZmluZSBpbnQgbG9uZyBsb25nCnZvaWQgc29sKCl7CiAgICBpbnQgbjsKICAgIGNpbiA+PiBuOwogICAgaW50IGFbbl0sIGFucyA9IDA7CiAgICBtYXA8aW50LCBpbnQ+IG07CiAgICBmb3IoaW50ICZpOmEpIGNpbiA+PiBpLCBtW2ldKys7CiAgICBmb3IoaW50IGkgPSAxOyBpIDwgMTAwMDAwMTsgaSsrKSBhbnMgKz0gbVtpICogaV0gKiBtW2kgKiBpICogaV07CiAgICBjb3V0IDw8IGFucyA8PCAnXG4nOwogICAgcmV0dXJuOwp9CnNpZ25lZCBtYWluKCl7CiAgICBpb3NfYmFzZTo6c3luY193aXRoX3N0ZGlvKGZhbHNlKTsKICAgIGNpbi50aWUoTlVMTCk7CiAgICBjb3V0LnRpZShOVUxMKTsKICAgIGludCB0ID0gMTsKICAgIC8vY2luID4+IHQ7CiAgICB3aGlsZSh0LS0pewogICAgICAgIHNvbCgpOwogICAgfQogICAgcmV0dXJuIDA7Cn0=