#include <iostream>
#include <cmath>
using namespace std;
int main()
{
int n, a[1005] = {};
cin >> n;
for (int i = 1; i <= n; i++)
cin >> a[i];
int ans = 0;
for (int i = 1; i <= n; i++)
{
for (int j = i + 1; j <= n; j++)
{
int num = a[i] + a[j];
int r = sqrt(num);
if (r * r == num)
ans++;
}
}
cout << ans;
return 0;
}