You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
436 B

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