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 aa[1000000];
int mark[10000001];
int check[10000001];
int gcd(int a, int b) {
  if (!b) return a;
  return gcd(b, a % b);
}
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    scanf("%d", &aa[i]);
    mark[aa[i]] = i + 1;
  }
  int res = 0;
  vector<vector<int> > V(1000001);
  for (int n = 1; n <= 10000; n++)
    for (int m = n + 1; m * m - n * n <= 10000000; m += 2) {
      if (2 * m * n > 10000000) break;
      if (gcd(m, n) > 1) continue;
      int a = m * m - n * n;
      int b = 2 * m * n;
      int c = m * m + n * n;
      if (a <= 10000000 && b <= 10000000 && mark[a] && mark[b]) {
        V[mark[a] - 1].push_back(mark[b] - 1);
        V[mark[b] - 1].push_back(mark[a] - 1);
      }
      if (b <= 10000000 && c <= 10000000 && mark[b] && mark[c]) {
        V[mark[b] - 1].push_back(mark[c] - 1);
        V[mark[c] - 1].push_back(mark[b] - 1);
      }
      if (c <= 10000000 && a <= 10000000 && mark[c] && mark[a]) {
        V[mark[c] - 1].push_back(mark[a] - 1);
        V[mark[a] - 1].push_back(mark[c] - 1);
      }
    }
  int ans = 0;
  for (int i = 0; i < n; i++)
    if (!check[i]) {
      ans++;
      queue<int> Q;
      Q.push(i);
      check[i] = 1;
      while (!Q.empty()) {
        int now = Q.front();
        Q.pop();
        for (int j = ((int)V[now].size()) - 1; j >= 0; j--)
          if (!check[V[now][j]]) {
            check[V[now][j]] = 1;
            Q.push(V[now][j]);
          }
      }
    }
  printf("%d\n", ans);
}