Problem: Misha decided to help Pasha and Akim be friends again. He had a cunning plan — to destroy all the laughy mushrooms. He knows that the laughy mushrooms can easily burst when they laugh. Mushrooms grow on the lawns. There are a[t] mushrooms on the t-th lawn.

Misha knows that the lawns where the mushrooms grow have a unique ability. A lawn (say, i) can transfer laugh to other lawn (say, j) if there exists an integer (say, b) such, that some permutation of numbers a[i], a[j] and b is a beautiful triple (i ≠ j). A beautiful triple is such three pairwise coprime numbers x, y, z, which satisfy the following condition: x2 + y2 = z2.

Misha wants to know on which minimal number of lawns he should laugh for all the laughy mushrooms to burst.

Input

The first line contains one integer n (1 ≤ n ≤ 106) which is the number of lawns. The next line contains n integers ai which are the number of mushrooms on the i-lawn (1 ≤ ai ≤ 107). All the numbers are different.

Output

Print a single number — the minimal number of lawns on which Misha should laugh for all the mushrooms to burst.

Examples

Input

1
2


Output

1


Input

2
1 2


Output

2


Input

2
3 5


Output

1

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
int n;
int cnt[10000001] = {};
int par[10000001], ra[10000001];
void dsuInit() {
  for (int i = 0; i < (int)(10000001); ++i) par[i] = i, ra[i] = cnt[i];
}
int dsuParent(int v) {
  if (v == par[v]) return v;
  return par[v] = dsuParent(par[v]);
}
void dsuMerge(int u, int v) {
  u = dsuParent(u);
  v = dsuParent(v);
  if (u == v) return;
  if (ra[u] < ra[v]) swap(u, v);
  par[v] = u;
  ra[u] += ra[v];
}
int gcd(int a, int b) {
  while (b) a %= b, swap(a, b);
  return a;
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < (int)(n); ++i) {
    int x;
    scanf("%d", &x);
    ++cnt[x];
  }
  dsuInit();
  for (int p = 1; p <= 3200; ++p) {
    for (int q = p + 1; 2 * p * q <= 10000000; q += 2) {
      if (gcd(p, q) != 1) continue;
      long long x = (long long)q * q - p * p;
      long long y = 2 * p * q;
      long long z = p * p + (long long)q * q;
      if (x <= 10000000 && y <= 10000000 && cnt[x] && cnt[y]) dsuMerge(x, y);
      if (x <= 10000000 && z <= 10000000 && cnt[x] && cnt[z]) dsuMerge(x, z);
      if (y <= 10000000 && z <= 10000000 && cnt[y] && cnt[z]) dsuMerge(y, z);
    }
  }
  int ans = 0;
  for (int i = 0; i < (int)(10000001); ++i)
    if (cnt[i] && dsuParent(i) == i) {
      if (ra[i] == cnt[i])
        ans += cnt[i];
      else
        ++ans;
    }
  printf("%d\n", ans);
  return 0;
}