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 MY = 10000000;
const int MX = 6000;
int n;
int a[2000000];
int f[10000010];
int p[2000000];
int gcd(int a, int b) {
  while (a > 0 && b > 0)
    if (a > b)
      a %= b;
    else
      b %= a;
  return a + b;
}
int ffget(int a) {
  if (p[a] == a) return a;
  p[a] = ffget(p[a]);
  return p[a];
}
void ffunion(int a, int b) {
  int f1 = ffget(a);
  int f2 = ffget(b);
  if (f1 != f2) p[f2] = f1;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    f[a[i]] = i;
    p[i] = i;
  }
  long long x, y, z;
  bool f1, f2, f3;
  for (int l1 = 1; l1 <= MX; l1++)
    for (int l2 = 1; l2 < l1; l2++) {
      if (((l1 & 1) != (l2 & 1)) && (gcd(l1, l2) == 1)) {
        x = l1 * l1 - l2 * l2;
        y = 2 * l1 * l2;
        z = l1 * l1 + l2 * l2;
        f1 = (x <= MY) && f[x];
        f2 = (y <= MY) && f[y];
        f3 = (z <= MY) && f[z];
        if (f1) {
          if (f2) ffunion(f[x], f[y]);
          if (f3) ffunion(f[x], f[z]);
        }
        if (f2 && f3) ffunion(f[y], f[z]);
      }
    }
  int ans = 0;
  for (int i = 1; i <= n; i++)
    if (ffget(i) == i) {
      ans++;
    }
  cout << ans << endl;
  return 0;
}