#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000005;
int par[maxn], data[maxn], ma, vi[maxn * 10];
bool vis(int x) { return (x <= ma && vi[x]); }
int findset(int x) {
  if (par[x] != x) par[x] = findset(par[x]);
  return par[x];
}
void unionset(int x, int y) {
  int fx = findset(x);
  int fy = findset(y);
  par[fx] = fy;
}
int gcd(int x, int y) {
  if (!x) return y;
  return gcd(y % x, x);
}
inline bool cop(int x, int y) { return gcd(x, y) == 1; }
int main() {
  int n;
  scanf("%d", &n);
  ma = 0;
  for (int i = 1; i <= n; i++) {
    scanf("%d", data + i);
    par[i] = i;
    ma = max(ma, data[i]);
    vi[data[i]] = i;
  }
  int upi = ceil(sqrt(1.5 * ma)), upj = ceil(sqrt(0.5 * ma));
  for (int i = 2; i <= upi; i++) {
    for (int j = (i & 1) ? 2 : 1; j < i && j <= upj; j += 2) {
      int a = i * i - j * j, b = 2 * i * j, c = i * i + j * j;
      if (cop(a, b) && vis(a) && vis(b)) {
        unionset(vi[a], vi[b]);
      }
      if (cop(a, c) && vis(a) && vis(c)) {
        unionset(vi[a], vi[c]);
      }
      if (cop(b, c) && vis(b) && vis(c)) {
        unionset(vi[b], vi[c]);
      }
    }
  }
  int res = 0;
  for (int i = 1; i <= n; i++)
    if (par[i] == i) res++;
  printf("%d\n", res);
}
