#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
struct unionset {
  int ud[1000111];
  void init() { memset(ud, -1, sizeof(ud)); }
  int root(int x) { return ud[x] < 0 ? x : ud[x] = root(ud[x]); }
  int size(int x) { return -ud[root(x)]; }
  bool same(int x, int y) { return root(x) == root(y); }
  bool set(int x, int y) {
    x = root(x);
    y = root(y);
    if (x != y) {
      if (ud[y] < ud[x]) std::swap(x, y);
      ud[x] += ud[y];
      ud[y] = x;
    }
    return x != y;
  }
} us;
int n, a[1000111];
int main() {
  us.init();
  scanf("%d", &n);
  for (int i = 0; i < (int)(n); i++) scanf("%d", a + i);
  sort(a, a + n);
  for (long long i = 2;; i++) {
    int t = 0;
    for (long long j = i % 2 ? 2 : 1; j < i; j += 2)
      if (gcd(i, j) == 1) {
        const long long x = i * i - j * j, y = 2 * i * j, z = i * i + j * j;
        if (x > (10000000LL)) continue;
        if (y > (10000000LL)) break;
        t++;
        const int xi = lower_bound(a, a + n, x) - a;
        const int yi = lower_bound(a, a + n, y) - a;
        const int zi = lower_bound(a, a + n, z) - a;
        if (a[xi] == x && a[yi] == y) us.set(xi, yi);
        if (a[yi] == y && a[zi] == z) us.set(yi, zi);
        if (a[zi] == z && a[xi] == x) us.set(zi, xi);
      }
    if (t == 0) break;
  }
  int c = 0;
  for (int i = 0; i < (int)(n); i++)
    if (us.root(i) == i) c++;
  printf("%d\n", c);
  return 0;
}
