#include <bits/stdc++.h>
using namespace std;
int m = 10000000;
int n;
int a[1000005];
int p[10000005];
long long gcd(long long a, long long b) {
  if (!b) return a;
  return gcd(b, a % b);
}
int get(int x) { return p[x] == x ? x : p[x] = get(p[x]); }
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    p[a[i]] = a[i];
  }
  int k = n;
  int x, y;
  for (long long j = 1; j <= m; j++)
    for (long long i = j + 1; 2 * i * j <= m && i * i - j * j <= m; i++)
      if (gcd(2 * i * j, i * i - j * j) == 1) {
        x = 2 * i * j;
        y = i * i - j * j;
        if (p[x] != 0 && p[y] != 0) {
          x = get(x);
          y = get(y);
          if (x != y) {
            k--;
            p[x] = y;
          }
        }
        if (i * i + j * j <= m) {
          x = 2 * i * j;
          y = i * i + j * j;
          if (p[x] != 0 && p[y] != 0) {
            x = get(x);
            y = get(y);
            if (x != y) {
              k--;
              p[x] = y;
            }
          }
        }
        if (i * i + j * j <= m) {
          x = i * i + j * j;
          y = i * i - j * j;
          if (p[x] != 0 && p[y] != 0) {
            x = get(x);
            y = get(y);
            if (x != y) {
              k--;
              p[x] = y;
            }
          }
        }
      }
  cout << k << endl;
  return 0;
}
