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 a[1000006], otac[10000006], marka[10000007];
int nadji(int x) {
  if (otac[x] != x) otac[x] = nadji(otac[x]);
  return otac[x];
}
void spoj(int x, int y) {
  int a, b;
  a = nadji(x);
  b = nadji(y);
  if (rand() % 2)
    otac[a] = b;
  else
    otac[b] = a;
}
int nzd(int a, int b) {
  if (b == 0)
    return a;
  else
    return nzd(b, a % b);
}
int main() {
  int n, m, i, j, MAX = 5000, x, y, z, res = 0, M = 10000000;
  cin >> n;
  for (i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    x = a[i];
    marka[x] = 1;
  }
  for (i = 1; i < M; i++) otac[i] = i;
  for (i = 1; i * i <= 4 * M; i++) {
    for (j = i + 1; j * j <= 4 * M; j++) {
      if (i % 2 == j % 2) continue;
      x = i * i + j * j;
      y = j * j - i * i;
      z = 2 * i * j;
      if (nzd(i, j) == 1) {
        if (max(x, y) <= M && marka[x] && marka[y] && nadji(x) != nadji(y))
          spoj(x, y);
        if (max(z, y) <= M && marka[y] && marka[z] && nadji(z) != nadji(y))
          spoj(z, y);
        if (max(x, z) <= M && marka[x] && marka[z] && nadji(x) != nadji(z))
          spoj(x, z);
      }
    }
  }
  set<int> SS;
  for (i = 1; i <= n; i++) {
    SS.insert(nadji(a[i]));
  }
  cout << SS.size();
  return 0;
}