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 p[21000000];
int l;
int nwd(int a, int b) { return (a == 0 ? b : nwd(b % a, a)); }
int zn(int x) {
  if (x == p[x]) return x;
  p[x] = zn(p[x]);
  return p[x];
}
void unia(int x, int y) {
  if (zn(x) == zn(y)) return;
  if ((l++) & 1)
    p[p[y]] = p[x];
  else
    p[p[x]] = p[y];
}
int main() {
  for (int i = 0; i <= (int)(10000000 + 2) - 1; i++) p[i] = -1;
  int n;
  l = 0;
  scanf("%d", &(n));
  int x0;
  for (int i = 0; i <= (int)(n)-1; i++) {
    scanf("%d", &(x0));
    p[x0] = x0;
  }
  int x, y, z;
  for (int b = 1; b * b <= 10000000 / 2; b++)
    for (int a = b + 1; a * a <= 2 * 10000000; a++) {
      if (a % 2 == 0 && b % 2 == 0) continue;
      if (a & 1 && b & 1) continue;
      if (nwd(a, b) == 1) {
        x = a * a - b * b;
        y = 2 * a * b;
        z = a * a + b * b;
        if (x <= 10000000 && y <= 10000000 && p[x] >= 0 && p[y] >= 0)
          unia(x, y);
        if (z <= 10000000 && p[x] >= 0 && p[z] >= 0) unia(x, z);
        if (z <= 10000000 && p[y] >= 0 && p[z] >= 0) unia(y, z);
      }
    }
  int wyn = 0;
  for (int i = 0; i <= (int)(10000000 + 1) - 1; i++)
    if (i == p[i]) wyn++;
  cout << wyn << endl;
  return 0;
}