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 = (int)1e6, M = (int)1e7 + 10;
int n, a[N], p[3 * M];
bool w[3 * M], used[3 * M], vis[3 * M];
int get(int i) {
  if (p[i] == i) return i;
  return p[i] = get(p[i]);
}
void join(int a, int b) {
  int c = get(a);
  int d = get(b);
  if (rand() & 1) swap(c, d);
  p[c] = d;
}
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
int main() {
  scanf("%d", &n);
  for (int i = 0; i < (int)n; ++i) {
    scanf("%d", &a[i]);
    w[a[i]] = 1;
  }
  for (int i = 0; i < (int)3 * M; ++i) p[i] = i;
  for (int u = 1; u * u <= 1.5 * M; u++)
    for (int v = 1; v < u; v++) {
      if ((((u & 1) == 0 || (v & 1) == 0) && gcd(u, v) == 1)) {
        int a = 2 * u * v;
        int b = u * u - v * v;
        int c = u * u + v * v;
        if (w[a] && w[b]) {
          join(a, b);
          used[a] = true;
          used[b] = true;
        }
        if (w[a] && w[c]) {
          join(a, c);
          used[a] = true;
          used[c] = true;
        }
        if (w[b] && w[c]) {
          join(b, c);
          used[c] = true;
          used[b] = true;
        }
      }
    }
  int ans = 0;
  for (int i = 0; i < (int)n; ++i) {
    if (!used[a[i]] || !vis[get(a[i])]) {
      ans++;
      vis[get(a[i])] = true;
    }
  }
  cout << ans << endl;
  return 0;
}