#include <bits/stdc++.h>
using namespace std;
const int MX = 10000003;
int p[MX];
inline int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
inline int find(int x) { return x != p[x] ? p[x] = find(p[x]) : x; }
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    int x;
    scanf("%d", &x);
    p[x] = x;
  }
  for (int x = 1; x * x < MX; ++x)
    for (int y = x + 1;; y += 2)
      if (gcd(x, y) == 1) {
        int a = y * y - x * x;
        int b = 2 * x * y;
        if (a >= MX || b >= MX) break;
        int c = x * x + y * y;
        if (p[a]) {
          if (p[b]) p[find(b)] = find(a);
          if (c < MX && p[c]) p[find(c)] = find(a);
        } else if (p[b] && c < MX && p[c])
          p[find(c)] = find(b);
      }
  int res = 0;
  for (int x = 1; x < MX; ++x)
    if (p[x] == x) ++res;
  printf("%d\n", res);
  return 0;
}
