#include <bits/stdc++.h>
const long long MOD = 1e9 + 7, INF = 1e18 + 1;
using namespace std;
long long a[1000000], cnt, n, m;
long long p[1000000], sz[1000000];
int d[10000001];
long long gcd(long long a, long long b) {
  if (!b)
    return (a > 1);
  else
    return gcd(b, a % b);
}
long long find(long long x) {
  if (p[x] == x)
    return x;
  else
    return p[x] = find(p[x]);
}
void unite(long long a, long long b) {
  a = find(a);
  b = find(b);
  if (a == b) return;
  if (sz[a] < sz[b]) swap(a, b);
  p[b] = a;
  sz[a] += sz[b];
  cnt--;
}
int main() {
  cin >> n;
  for (long long i = 0; i < n; i++) {
    p[i] = i;
    sz[i] = 1;
  }
  memset(d, -1, sizeof(d));
  cnt = n;
  for (long long i = 0; i < n; i++) {
    scanf("%lld", &a[i]);
    d[a[i]] = i;
    m = max(m, a[i]);
  }
  for (long long y = 0; y <= m; y++)
    for (long long x = y + 1; x * x - y * y <= m && 2 * x * y <= m; x++) {
      long long x1 = x * x + y * y;
      long long x2 = 2 * x * y;
      long long x3 = x * x - y * y;
      if (gcd(x1, x2) || gcd(x2, x3) || gcd(x1, x3)) continue;
      if (x1 <= m && d[x1] >= 0 && d[x2] >= 0) unite(d[x1], d[x2]);
      if (x1 <= m && d[x1] >= 0 && d[x3] >= 0) unite(d[x1], d[x3]);
      if (d[x2] >= 0 && d[x3] >= 0) unite(d[x2], d[x3]);
    }
  cout << cnt;
}
