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 N = 1000004;
int n;
int gcd(int first, int second) {
  return first ? gcd(second % first, first) : second;
}
bool vis[10000005];
bool use[10000005];
long long sq(long long first) {
  long long u = sqrt((double)first);
  while (u > 0 && u * u > first) u--;
  while (u * u < first) u++;
  if (u * u == first)
    return u;
  else
    return -1;
}
int a[N];
const int M = 10000005;
int p[M];
int find(int first) {
  if (first == p[first]) return first;
  return p[first] = find(p[first]);
}
void uni(int first, int second) {
  if (first >= M || second >= M) return;
  if (!use[first] || !use[second]) return;
  int px = find(first);
  int py = find(second);
  p[px] = py;
}
int main() {
  memset(use, 0, sizeof(use));
  memset(vis, 0, sizeof(vis));
  scanf("%d", &n);
  for (int i = (0); i < (int)(n); i++) {
    scanf("%d", a + i);
    use[a[i]] = 1;
  }
  for (int i = (0); i < (int)(M); i++) {
    p[i] = i;
  }
  int mx = 0;
  for (int i = (0); i < (int)(n); i++) mx = max(mx, a[i]);
  int cc = 0;
  for (long long u = 1; u * u <= mx; u += 2) {
    for (long long v = 1; u * u + v * v * 2 + 2 * u * v <= mx * sqrt(2.0) + 5;
         v++) {
      if (gcd(u, v) != 1) continue;
      long long g = u * u;
      long long h = 2 * v * v;
      long long i = 2 * u * v;
      long long a = g + i;
      long long b = h + i;
      long long c = g + h + i;
      int cnt = (use[a]) + (use[b]) + (use[c]);
      uni(a, b);
      uni(a, c);
      uni(b, c);
      if (cnt >= 2) {
        ++cc;
      }
    }
  }
  int ans = 0;
  for (int i = (0); i < (int)(n); i++) {
    ans += (a[i] == find(a[i]));
  }
  printf("%d\n", ans);
  return 0;
}