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 MAX_A = 1e7 + 5;
const int MAX_N = 1e6 + 5;
long long gcd(long long p, long long q) {
  if (q == 0) return p;
  return gcd(q, p % q);
}
long long sq(long long x) { return x * x; }
bool is_perfect(long long x) {
  long long sqx = sqrt(x);
  if (sqx * sqx == x) return true;
  if ((sqx - 1) * (sqx - 1) == x) return true;
  if ((sqx + 1) * (sqx + 1) == x) return true;
  return false;
}
int arr[MAX_N];
int pos[MAX_A];
int root[MAX_N];
int height[MAX_N];
int find(int u) {
  if (root[u] != u) {
    root[u] = find(root[u]);
  }
  return root[u];
}
void merge(int u, int v) {
  u = find(u);
  v = find(v);
  if (u != v) {
    if (height[u] < height[v]) {
      swap(u, v);
    }
    root[v] = u;
    if (height[u] == height[v]) {
      height[u]++;
    }
  }
}
int main() {
  for (int i = 1; i < MAX_N; i++) {
    root[i] = i;
  }
  ios::sync_with_stdio(false);
  int length;
  cin >> length;
  for (int i = 1; i <= length; i++) {
    cin >> arr[i];
    pos[arr[i]] = i;
  }
  for (int m = 2; m * m < 3 * MAX_A; m++) {
    for (int n = 1; n < m; n++) {
      if (m % 2 == 0 || n % 2 == 0) {
        if (gcd(m, n) == 1) {
          int a = sq(m) - sq(n);
          int b = 2 * m * n;
          int c = sq(m) + sq(n);
          if (a < MAX_A && b < MAX_A) {
            if (pos[a] && pos[b]) {
              merge(pos[a], pos[b]);
            }
          }
          if (a < MAX_A && c < MAX_A) {
            if (pos[a] && pos[c]) {
              merge(pos[a], pos[c]);
            }
          }
          if (b < MAX_A && c < MAX_A) {
            if (pos[b] && pos[c]) {
              merge(pos[b], pos[c]);
            }
          }
        }
      }
    }
  }
  int ans = 0;
  for (int i = 1; i <= length; i++) {
    if (find(i) == i) {
      ans++;
    }
  }
  cout << ans << endl;
}