#include <bits/stdc++.h>
using namespace std;
int a[1010100], fa[1010100], id[10010001];
int n, limit = 10000000;
int ok(int x) {
  if (fa[x] == x) return x;
  fa[x] = ok(fa[x]);
  return fa[x];
}
void merge(int x, int y) {
  x = id[x], y = id[y];
  x = ok(x);
  y = ok(y);
  fa[x] = y;
}
int gcd(int a, int b) { return (!b) ? a : gcd(b, a % b); }
int main() {
  scanf("%d", &n);
  memset(id, 0, sizeof(id));
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    id[a[i]] = i;
    fa[i] = i;
  }
  for (int p = 1; p * p <= limit; p++)
    for (int q = 2;; q += 2) {
      int x = ((p) * (p)) + p * q;
      int y = ((q) * (q)) / 2 + p * q;
      int z = x + y - p * q;
      if (x > limit || y > limit) break;
      if (id[x] && id[y] && gcd(x, y) == 1) merge(x, y);
      if (z <= limit && id[x] && id[z] && gcd(x, z) == 1) merge(x, z);
      if (z <= limit && id[y] && id[z] && gcd(y, z) == 1) merge(y, z);
    }
  for (int i = 1; i <= n; i++) fa[i] = ok(i);
  memset(id, 0, sizeof(id));
  int ans = 0;
  for (int i = 1; i <= n; i++)
    if (!id[fa[i]]) id[fa[i]] = 1, ans++;
  cout << ans << endl;
  return 0;
}
