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>
const int max = 10000001;
const int maxn = 1000000;
using std::vector;
int pos[max];
int a[maxn];
int n;
int sets;
int p[maxn], r[maxn];
void init() {
  for (int i = 0; i < n; i++) {
    p[i] = i;
  }
  sets = n;
}
int get(int i) {
  if (p[i] != i) p[i] = get(p[i]);
  return p[i];
}
void unionsets(int i, int j) {
  i = get(i);
  j = get(j);
  if (i == j) return;
  --sets;
  if (r[i] < r[j]) {
    p[i] = j;
  } else {
    p[j] = i;
    if (r[i] == r[j]) r[i]++;
  }
}
int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
void get1() {
  for (int v = 1; 2 * v * v < max; ++v) {
    int vv = v * v;
    for (int u = v + 1;; u += 2) {
      if (gcd(u, v) != 1) continue;
      int number = u * u + vv;
      if (number >= max) break;
      if (pos[number] == -1) continue;
      int val = number - (vv << 1);
      if (pos[val] != -1) unionsets(pos[val], pos[number]);
      val = 2 * u * v;
      if (val < max) {
        if (pos[val] != -1) unionsets(pos[val], pos[number]);
      }
    }
    for (int u = v + 1;; u += 2) {
      if (gcd(u, v) != 1) continue;
      int number = 2 * u * v;
      if (number >= max) break;
      int val = u * u - vv;
      if (val >= max) break;
      if (pos[number] == -1) continue;
      if (pos[val] != -1) unionsets(pos[val], pos[number]);
    }
  }
}
int main() {
  for (int i = 0; i < max; i++) {
    pos[i] = -1;
  }
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &(a[i]));
    pos[a[i]] = i;
  }
  init();
  get1();
  printf("%d\n", sets);
  return 0;
}