#include <iostream>
using namespace std;
#define int long long
int n,a[200010],t[200010],ans;
int fen(int x){
int tmp=1;
for(int i=2;i*i<=x;i++){
if(x%i==0){
int ci=0;
while(x%i==0)
x/=i,ci++;
if(ci%2)
tmp*=i;
}
}
tmp*=x;
return tmp;
}
signed main(){
cin>>n;
for(int i=1;i<=n;i++){
cin>>a[i];
if(a[i]==0)
continue;
a[i]=fen(a[i]);
}
for(int i=1;i<=n;i++)
t[a[i]]++,ans+=t[a[i]]*(a[i]!=0)+t[0]-1;
cout<<ans;
return 0;
}
/*
┏┓ ┏┓
┏┛┻━━━┛┻┓
┃ ┃
┃ ━ ┃
┃ ┳┛ ┗┳ ┃
┃ ┃
┃ ┻ ┃
┃ ┃
┗━┓ ┏━┛Codes are far away from bugs with the animal protecting
┃ ┃ 神兽保佑,代码无bug
┃ ┃
┃ ┗━━━┓
┃ ┣┓
┃ ┏┛
┗┓┓┏━┳┓┏┛
┃┫┫ ┃┫┫
┗┻┛ ┗┻┛ ○| ̄|_
*/