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;
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
struct unionset {
  int ud[1000111];
  void init() { memset(ud, -1, sizeof(ud)); }
  int root(int x) { return ud[x] < 0 ? x : ud[x] = root(ud[x]); }
  int size(int x) { return -ud[root(x)]; }
  bool same(int x, int y) { return root(x) == root(y); }
  bool set(int x, int y) {
    x = root(x);
    y = root(y);
    if (x != y) {
      if (ud[y] < ud[x]) std::swap(x, y);
      ud[x] += ud[y];
      ud[y] = x;
    }
    return x != y;
  }
} us;
int n, a[1000111];
int main() {
  us.init();
  scanf("%d", &n);
  for (int i = 0; i < (int)(n); i++) scanf("%d", a + i);
  sort(a, a + n);
  for (long long i = 2;; i++) {
    int t = 0;
    for (long long j = i % 2 ? 2 : 1; j < i; j += 2)
      if (gcd(i, j) == 1) {
        const long long x = i * i - j * j, y = 2 * i * j, z = i * i + j * j;
        if (x > (10000000LL)) continue;
        if (y > (10000000LL)) break;
        t++;
        const int xi = lower_bound(a, a + n, x) - a;
        const int yi = lower_bound(a, a + n, y) - a;
        const int zi = lower_bound(a, a + n, z) - a;
        if (a[xi] == x && a[yi] == y) us.set(xi, yi);
        if (a[yi] == y && a[zi] == z) us.set(yi, zi);
        if (a[zi] == z && a[xi] == x) us.set(zi, xi);
      }
    if (t == 0) break;
  }
  int c = 0;
  for (int i = 0; i < (int)(n); i++)
    if (us.root(i) == i) c++;
  printf("%d\n", c);
  return 0;
}