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 MN = 1000 * 1000 + 10;
int ar[MN], n, p[MN], r[MN];
bool used[MN];
int up(int x) {
  if (p[x] == x) return x;
  p[x] = up(p[x]);
  return p[x];
}
inline void join(int x, int y) {
  x = up(x);
  y = up(y);
  if (r[x] > r[y])
    p[y] = x;
  else {
    p[x] = y;
    if (r[x] == r[y]) ++r[y];
  }
}
inline int get_num(int x) {
  int left = 0, right = n - 1;
  while (left <= right) {
    int mid = (left + right) / 2;
    if (ar[mid] < x)
      left = mid + 1;
    else if (ar[mid] > x)
      right = mid - 1;
    else
      return mid;
  }
}
inline int gcd(int a, int b) {
  if (!a || !b) return a + b;
  return gcd(b, a % b);
}
int main() {
  srand(time(0));
  cin >> n;
  for (int i = 0; i < n; i++) {
    scanf("%d", &ar[i]);
    p[i] = i;
  }
  sort(ar, ar + n);
  int mx_el = *max_element(ar, ar + n);
  int my = (int)sqrt(mx_el / 2.0) + 1;
  int mx = (int)sqrt(3 * mx_el / 2.0);
  for (int y = 1; y <= my; y++) {
    int x = y + 1;
    bool f = true;
    while (f) {
      if (x > mx) break;
      int a = x * x - y * y;
      int b = 2 * x * y;
      int c = x * x + y * y;
      if (gcd(a, b) != 1 || gcd(b, c) != 1 || gcd(a, c) != 1) {
        x++;
        continue;
      }
      bool f1, f2, f3;
      f1 = binary_search(ar, ar + n, a);
      f2 = binary_search(ar, ar + n, b);
      f3 = binary_search(ar, ar + n, c);
      if (f1 && f2) join(get_num(a), get_num(b));
      if (f1 && f3) join(get_num(a), get_num(c));
      if (f2 && f3) join(get_num(b), get_num(c));
      x++;
    }
  }
  int ans = 0;
  for (int i = 0; i < n; i++) {
    if (!used[up(p[i])]) {
      ans++;
      used[up(p[i])] = true;
    }
  }
  cout << ans;
  return 0;
}