#include <bits/stdc++.h>
using namespace std;
int N;
list<int> adj[1000005];
int T[1000005];
bool visited[1000005];
bool uniq[1000005];
int rev[10000005];
void dfs(int v) {
  visited[v] = true;
  for (list<int>::iterator it = adj[v].begin(); it != adj[v].end(); it++) {
    if (!visited[*it]) dfs(*it);
  }
}
int gcd(int a, int b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
int main() {
  scanf("%d", &N);
  for (int i = 0; i < (N); i++) scanf("%d", &T[i]);
  sort(T, T + N);
  T[N] = -1;
  for (int i = 0; i < (10000001); i++) rev[i] = N;
  for (int i = 0; i < (N); i++) rev[T[i]] = i;
  int temp[3];
  int v[3];
  for (int i = 1; i <= 5000; i += 2)
    for (int j = 2; i * i + j * j <= T[N - 1]; j += 2) {
      if (gcd(i, j) > 1) continue;
      temp[0] = abs(i * i - j * j);
      temp[1] = i * i + j * j;
      temp[2] = 2 * i * j;
      for (int t = 0; t < (3); t++) v[t] = rev[temp[t]];
      for (int u = 0; u < (3); u++)
        for (int s = 0; s < (u); s++) {
          if ((T[v[u]] == temp[u]) && (T[v[s]] == temp[s])) {
            adj[v[u]].push_back(v[s]);
            adj[v[s]].push_back(v[u]);
          }
        }
    }
  for (int i = 1; i <= T[N - 1]; i += 2)
    for (int j = 2; i * j <= T[N - 1]; j += 2) {
      if (gcd(i, j) > 1) continue;
      long long int L1 = abs(i * (long long int)i - j * (long long int)j);
      long long int L2 = 2 * i * j;
      if (L1 > 10000000 || L2 > 10000000) continue;
      int v1 = rev[L1];
      int v2 = rev[L2];
      if ((T[v1] == L1) && (T[v2] == L2)) {
        adj[v1].push_back(v2);
        adj[v2].push_back(v1);
      }
    }
  for (int i = 0; i < (N); i++) visited[i] = false;
  int result = 0;
  for (int i = 0; i < (N); i++)
    if (!visited[i]) {
      result++;
      dfs(i);
    }
  printf("%d\n", result);
}
