#include <bits/stdc++.h>
using namespace std;
int a[1010];
bool pf(int x)
{
if(sqrt(x) * sqrt(x) == x)
{
return true;
}
return false;
}
int main()
{
int n;
cin >> n;
for(int i = 1; i <= n; i++)
{
cin >> a[i];
}
int cnt = 0;
for(int i = 1; i <= n; i++)
{
for(int j = 1; j <= n; j++)
{
if(pf(a[i] + a[j]))
{
cnt++;
}
}
}
cout << cnt << endl;
return 0;
}