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;
const int MAXN = 1000000 + 1;
int a[MAXN], parent[MAXN], rnk[MAXN], p[10 * MAXN];
int n;
void make_set(int v) {
  parent[v] = v;
  rnk[v] = 0;
}
int find_set(int v) {
  if (v == parent[v]) return v;
  return parent[v] = find_set(parent[v]);
}
void union_sets(int u, int v) {
  u = find_set(u);
  v = find_set(v);
  if (u != v) {
    if (rnk[u] < rnk[v]) swap(u, v);
    parent[v] = u;
    if (rnk[u] == rnk[v]) ++rnk[u];
  }
}
int gcd(int x, int y) { return x ? gcd(y % x, x) : y; }
bool check(int m[3]) {
  return gcd(m[0], m[1]) == 1 && gcd(m[1], m[2]) == 1 && gcd(m[0], m[2]) == 1;
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &a[i]);
    make_set(i);
    p[a[i]] = i + 1;
  }
  sort(a, a + n);
  for (int i = 2; i * i <= 2 * a[n - 1]; ++i)
    for (int j = 1; j < i; ++j) {
      int t[3] = {i * i - j * j, 2 * i * j, i * i + j * j};
      if (!check(t)) continue;
      int pos[3];
      for (int k = 0; k < 3; ++k)
        if (t[k] <= a[n - 1]) pos[k] = p[t[k]];
      if (t[0] <= a[n - 1] && t[1] <= a[n - 1] && pos[0] && pos[1])
        union_sets(pos[0] - 1, pos[1] - 1);
      if (t[1] <= a[n - 1] && t[2] <= a[n - 1] && pos[1] && pos[2])
        union_sets(pos[1] - 1, pos[2] - 1);
      if (t[0] <= a[n - 1] && t[2] <= a[n - 1] && pos[0] && pos[2])
        union_sets(pos[0] - 1, pos[2] - 1);
    }
  set<int> f;
  for (int i = 0; i < n; ++i) f.insert(find_set(i));
  printf("%d", f.size());
  return 0;
}