#include <bits/stdc++.h>
using namespace std;
int p[21000000];
int l;
int nwd(int a, int b) { return (a == 0 ? b : nwd(b % a, a)); }
int zn(int x) {
  if (x == p[x]) return x;
  p[x] = zn(p[x]);
  return p[x];
}
void unia(int x, int y) {
  if (zn(x) == zn(y)) return;
  if ((l++) & 1)
    p[p[y]] = p[x];
  else
    p[p[x]] = p[y];
}
int main() {
  for (int i = 0; i <= (int)(10000000 + 2) - 1; i++) p[i] = -1;
  int n;
  l = 0;
  scanf("%d", &(n));
  int x0;
  for (int i = 0; i <= (int)(n)-1; i++) {
    scanf("%d", &(x0));
    p[x0] = x0;
  }
  int x, y, z;
  for (int b = 1; b * b <= 10000000 / 2; b++)
    for (int a = b + 1; a * a <= 2 * 10000000; a++) {
      if (a % 2 == 0 && b % 2 == 0) continue;
      if (a & 1 && b & 1) continue;
      if (nwd(a, b) == 1) {
        x = a * a - b * b;
        y = 2 * a * b;
        z = a * a + b * b;
        if (x <= 10000000 && y <= 10000000 && p[x] >= 0 && p[y] >= 0)
          unia(x, y);
        if (z <= 10000000 && p[x] >= 0 && p[z] >= 0) unia(x, z);
        if (z <= 10000000 && p[y] >= 0 && p[z] >= 0) unia(y, z);
      }
    }
  int wyn = 0;
  for (int i = 0; i <= (int)(10000000 + 1) - 1; i++)
    if (i == p[i]) wyn++;
  cout << wyn << endl;
  return 0;
}
