#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1000000 + 1;
int a[MAXN], parent[MAXN], rnk[MAXN], p[10 * MAXN];
int n;
void make_set(int v) {
  parent[v] = v;
  rnk[v] = 0;
}
int find_set(int v) {
  if (v == parent[v]) return v;
  return parent[v] = find_set(parent[v]);
}
void union_sets(int u, int v) {
  u = find_set(u);
  v = find_set(v);
  if (u != v) {
    if (rnk[u] < rnk[v]) swap(u, v);
    parent[v] = u;
    if (rnk[u] == rnk[v]) ++rnk[u];
  }
}
int gcd(int x, int y) { return x ? gcd(y % x, x) : y; }
bool check(int m[3]) {
  return gcd(m[0], m[1]) == 1 && gcd(m[1], m[2]) == 1 && gcd(m[0], m[2]) == 1;
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &a[i]);
    make_set(i);
    p[a[i]] = i + 1;
  }
  sort(a, a + n);
  for (int i = 2; i * i <= 2 * a[n - 1]; ++i)
    for (int j = 1; j < i; ++j) {
      int t[3] = {i * i - j * j, 2 * i * j, i * i + j * j};
      if (!check(t)) continue;
      int pos[3];
      for (int k = 0; k < 3; ++k)
        if (t[k] <= a[n - 1]) pos[k] = p[t[k]];
      if (t[0] <= a[n - 1] && t[1] <= a[n - 1] && pos[0] && pos[1])
        union_sets(pos[0] - 1, pos[1] - 1);
      if (t[1] <= a[n - 1] && t[2] <= a[n - 1] && pos[1] && pos[2])
        union_sets(pos[1] - 1, pos[2] - 1);
      if (t[0] <= a[n - 1] && t[2] <= a[n - 1] && pos[0] && pos[2])
        union_sets(pos[0] - 1, pos[2] - 1);
    }
  set<int> f;
  for (int i = 0; i < n; ++i) f.insert(find_set(i));
  printf("%d", f.size());
  return 0;
}
