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;
list<int> adj[1000005];
int T[1000005];
bool visited[1000005];
bool uniq[1000005];
int rev[10000005];
void dfs(int v) {
  visited[v] = true;
  for (list<int>::iterator it = adj[v].begin(); it != adj[v].end(); it++) {
    if (!visited[*it]) dfs(*it);
  }
}
int gcd(int a, int b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
int main() {
  scanf("%d", &N);
  for (int i = 0; i < (N); i++) scanf("%d", &T[i]);
  sort(T, T + N);
  T[N] = -1;
  for (int i = 0; i < (10000001); i++) rev[i] = N;
  for (int i = 0; i < (N); i++) rev[T[i]] = i;
  int temp[3];
  int v[3];
  for (int i = 1; i <= 3000; i++)
    for (int j = i + 1; (j * j - i * i <= T[N - 1]) && (2 * i * j <= T[N - 1]);
         j += 2) {
      if (gcd(i, j) > 1) continue;
      temp[0] = j * j - i * i;
      temp[1] = i * i + j * j;
      temp[2] = 2 * i * j;
      for (int t = 0; t < (3); t++)
        v[t] = (temp[t] <= T[N - 1]) ? rev[temp[t]] : N;
      for (int u = 0; u < (3); u++)
        for (int s = 0; s < (u); s++) {
          if ((T[v[u]] == temp[u]) && (T[v[s]] == temp[s])) {
            adj[v[u]].push_back(v[s]);
            adj[v[s]].push_back(v[u]);
          }
        }
    }
  for (int i = 0; i < (N); i++) visited[i] = false;
  int result = 0;
  for (int i = 0; i < (N); i++)
    if (!visited[i]) {
      result++;
      dfs(i);
    }
  printf("%d\n", result);
}