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, 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);
}