#include <bits/stdc++.h>
using namespace std;
int n, m;
int a[1000010], rt[1000010];
int mp[10000100];
int root(int t) {
  int tmp, ret = t;
  while (rt[ret] != ret) {
    ret = rt[ret];
  }
  while (t != ret) {
    tmp = rt[t];
    rt[t] = ret;
    t = tmp;
  }
  return ret;
}
void merge(int p, int q) {
  int s = mp[p], t = mp[q];
  int rot = root(s), tmp;
  while (rt[t] != rot) {
    tmp = rt[t];
    rt[t] = rot;
    t = tmp;
  }
}
const int A[3][3] = {{1, -2, 2}, {2, -1, 2}, {2, -2, 3}};
const int B[3][3] = {{1, 2, 2}, {2, 1, 2}, {2, 2, 3}};
const int C[3][3] = {{-1, 2, 2}, {-2, 1, 2}, {-2, 2, 3}};
void dfs(int a[3]) {
  if (a[0] > m || a[1] > m) return;
  if (mp[a[0]] && mp[a[1]]) merge(a[0], a[1]);
  if (a[2] <= m) {
    if (mp[a[0]] && mp[a[2]]) merge(a[0], a[2]);
    if (mp[a[1]] && mp[a[2]]) merge(a[1], a[2]);
  }
  int b[3];
  for (int i = 0; i < 3; ++i)
    b[i] = A[i][0] * a[0] + A[i][1] * a[1] + A[i][2] * a[2];
  dfs(b);
  for (int i = 0; i < 3; ++i)
    b[i] = B[i][0] * a[0] + B[i][1] * a[1] + B[i][2] * a[2];
  dfs(b);
  for (int i = 0; i < 3; ++i)
    b[i] = C[i][0] * a[0] + C[i][1] * a[1] + C[i][2] * a[2];
  dfs(b);
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", a + i);
  sort(a + 1, a + n + 1);
  n = unique(a + 1, a + n + 1) - a - 1;
  m = a[n];
  for (int i = 1; i <= n; i++) mp[a[i]] = i;
  for (int i = 1; i <= n; i++) rt[i] = i;
  int t[3] = {3, 4, 5};
  dfs(t);
  int tot = 0;
  for (int i = 1; i <= n; i++)
    if (rt[i] == i) tot++;
  printf("%d\n", tot);
}
