#include <bits/stdc++.h>
using namespace std;
int n;
int cnt[10000001] = {};
int par[10000001], ra[10000001];
void dsuInit() {
  for (int i = 0; i < (int)(10000001); ++i) par[i] = i, ra[i] = cnt[i];
}
int dsuParent(int v) {
  if (v == par[v]) return v;
  return par[v] = dsuParent(par[v]);
}
void dsuMerge(int u, int v) {
  u = dsuParent(u);
  v = dsuParent(v);
  if (u == v) return;
  if (ra[u] < ra[v]) swap(u, v);
  par[v] = u;
  ra[u] += ra[v];
}
int gcd(int a, int b) {
  while (b) a %= b, swap(a, b);
  return a;
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < (int)(n); ++i) {
    int x;
    scanf("%d", &x);
    ++cnt[x];
  }
  dsuInit();
  for (int p = 1; p <= 3200; ++p) {
    for (int q = p + 1; 2 * p * q <= 10000000; q += 2) {
      if (gcd(p, q) != 1) continue;
      long long x = (long long)q * q - p * p;
      long long y = 2 * p * q;
      long long z = p * p + (long long)q * q;
      if (x <= 10000000 && y <= 10000000 && cnt[x] && cnt[y]) dsuMerge(x, y);
      if (x <= 10000000 && z <= 10000000 && cnt[x] && cnt[z]) dsuMerge(x, z);
      if (y <= 10000000 && z <= 10000000 && cnt[y] && cnt[z]) dsuMerge(y, z);
    }
  }
  int ans = 0;
  for (int i = 0; i < (int)(10000001); ++i)
    if (cnt[i] && dsuParent(i) == i) {
      if (ra[i] == cnt[i])
        ans += cnt[i];
      else
        ++ans;
    }
  printf("%d\n", ans);
  return 0;
}
