#include <bits/stdc++.h>
using namespace std;
const int N = 1000004;
int n;
int gcd(int first, int second) {
  return first ? gcd(second % first, first) : second;
}
bool vis[10000005];
bool use[10000005];
long long sq(long long first) {
  long long u = sqrt((double)first);
  while (u > 0 && u * u > first) u--;
  while (u * u < first) u++;
  if (u * u == first)
    return u;
  else
    return -1;
}
int a[N];
const int M = 10000005;
int p[M];
int find(int first) {
  if (first == p[first]) return first;
  return p[first] = find(p[first]);
}
void uni(int first, int second) {
  if (first >= M || second >= M) return;
  if (!use[first] || !use[second]) return;
  int px = find(first);
  int py = find(second);
  p[px] = py;
}
int main() {
  memset(use, 0, sizeof(use));
  memset(vis, 0, sizeof(vis));
  scanf("%d", &n);
  for (int i = (0); i < (int)(n); i++) {
    scanf("%d", a + i);
    use[a[i]] = 1;
  }
  for (int i = (0); i < (int)(M); i++) {
    p[i] = i;
  }
  int mx = 0;
  for (int i = (0); i < (int)(n); i++) mx = max(mx, a[i]);
  int cc = 0;
  for (long long u = 1; u * u <= mx; u += 2) {
    for (long long v = 1; u * u + v * v * 2 + 2 * u * v <= mx * sqrt(2.0) + 5;
         v++) {
      if (gcd(u, v) != 1) continue;
      long long g = u * u;
      long long h = 2 * v * v;
      long long i = 2 * u * v;
      long long a = g + i;
      long long b = h + i;
      long long c = g + h + i;
      int cnt = (use[a]) + (use[b]) + (use[c]);
      uni(a, b);
      uni(a, c);
      uni(b, c);
      if (cnt >= 2) {
        ++cc;
      }
    }
  }
  int ans = 0;
  for (int i = (0); i < (int)(n); i++) {
    ans += (a[i] == find(a[i]));
  }
  printf("%d\n", ans);
  return 0;
}
