#include <bits/stdc++.h>
using namespace std;
long long gcd(long long x, long long y) {
  while (x && y)
    if (x >= y)
      x %= y;
    else
      y %= x;
  return x + y;
}
const int maxn = 10001000;
int a[maxn];
int rnk[maxn];
int find(int x) { return x == a[x] ? x : a[x] = find(a[x]); }
void _union(int x, int y) {
  x = find(x);
  y = find(y);
  if (rnk[x] > rnk[y]) {
    a[y] = x;
  } else {
    a[x] = y;
    if (rnk[x] == rnk[y]) rnk[y]++;
  }
}
bool good(int x, int y) {
  if (a[x] && a[y] && find(x) != find(y)) {
    _union(x, y);
    return 1;
  }
  return 0;
}
int main() {
  memset(rnk, 0, sizeof(rnk));
  memset(a, 0, sizeof(a));
  int N;
  cin >> N;
  int ta;
  for (int _n(N), i(0); i < _n; i++) {
    cin >> ta;
    a[ta] = ta;
  }
  long long j, x, y, z;
  int ans = N;
  for (long long i = 1; i < maxn; ++i) {
    for (j = i + 1;
         (x = 2LL * i * j) < maxn && (y = j * j - 1LL * i * i) < maxn; ++j) {
      if ((i + j) % 2 == 0) continue;
      if (gcd(i, j) != 1) continue;
      z = j * j + 1LL * i * i;
      if (good(x, y)) --ans;
      if (z < maxn) {
        if (good(x, z)) --ans;
        if (good(y, z)) --ans;
      }
    }
  }
  cout << ans << endl;
  return 0;
}
