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;
using ll = long long;
using ld = double;
void err(istream_iterator<string> it) {}
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
  cout << *it << " = " << a << endl;
  err(++it, args...);
}
const ll MODBASE = 1000000007LL;
const int MAXN = 1000010;
const int MAXM = 10000010;
const int MAXK = 110;
const int MAXQ = 200010;
int n, nt[MAXM], a[MAXN], res, lab[MAXN];
int ma[MAXM];
vector<ll> b;
void sieveBase(int n) {
  for (int i = (2); i <= (n); i++) {
    if (nt[i] == 0) {
      nt[i] = i;
      for (ll j = (ll)i * i; j <= n; j += i) nt[j] = i;
    }
  }
}
int getRoot(int u) {
  while (lab[u] > 0) u = lab[u];
  return u;
}
void unionFind(int u, int v) {
  int x = lab[u] + lab[v];
  if (lab[u] < lab[v]) {
    lab[v] = u;
    lab[u] = x;
  } else {
    lab[u] = v;
    lab[v] = x;
  }
}
void integerFactorization(int p) {
  b.clear();
  while (p > 1) {
    int h = nt[p];
    int w = 1;
    while (p % h == 0) {
      p /= h;
      w *= h;
    }
    b.emplace_back((ll)w * w);
  }
}
void solve(int pos, ll lef, ll rig, int a) {
  if (pos >= int((b).size())) {
    ll g = lef + rig;
    ll c = g / 2;
    ll b = max(lef, rig) - c;
    if (b <= 10000000 && ma[int(b)]) {
      int u = getRoot(ma[a]);
      int v = getRoot(ma[int(b)]);
      if (u != v) unionFind(u, v);
    }
    if (c <= 10000000 && ma[int(c)]) {
      int u = getRoot(ma[a]);
      int v = getRoot(ma[int(c)]);
      if (u != v) unionFind(u, v);
    }
    return;
  }
  lef *= b[pos];
  solve(pos + 1, lef, rig, a);
  lef /= b[pos];
  rig *= b[pos];
  solve(pos + 1, lef, rig, a);
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(nullptr);
  sieveBase(10000000);
  cin >> n;
  for (int i = (1); i <= (n); i++) {
    cin >> a[i];
    ma[a[i]] = i;
  }
  for (int i = (1); i <= (n); i++) lab[i] = -1;
  for (int i = (1); i <= (n); i++)
    if (a[i] == 1)
      continue;
    else if (a[i] % 2) {
      integerFactorization(a[i]);
      ll lef = b[0];
      ll rig = 1;
      solve(1, lef, rig, a[i]);
    } else {
      if (a[i] % 4 == 0) {
        integerFactorization(a[i]);
        for (int j = (0); j <= (int((b).size()) - 1); j++)
          if (b[j] % 2 == 0) {
            if (j != 0) swap(b[j], b[0]);
            break;
          }
        ll lef = b[0] / 2;
        ll rig = 2;
        solve(1, lef, rig, a[i]);
      } else {
        continue;
      }
    }
  for (int i = (1); i <= (n); i++) res += (lab[i] < 0);
  cout << res;
  return 0;
}