#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC optimization("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
long long const mod1 = 998244353;
long long const mod = 1e9 + 7;
long long const hashmod = 1610612741;
const long long inf = LLONG_MAX;
long long toint(const string &s) {
  stringstream ss;
  ss << s;
  long long x;
  ss >> x;
  return x;
}
string tostring(long long number) {
  stringstream ss;
  ss << number;
  return ss.str();
}
struct cmp {
  bool operator()(pair<long long, long long> a, pair<long long, long long> b) {
    return (a.first < b.first);
  }
};
long long modexp(long long x, long long n) {
  if (n == 0) {
    return 1;
  } else if (n & 1) {
    return (modexp((x * x) % mod, n / 2) % mod * x % mod) % mod;
  } else {
    return (modexp((x * x) % mod, n / 2) % mod);
  }
}
long long modinv(long long n) { return modexp(n, mod - 2) % mod; }
long long gcd(long long a, long long b) {
  if (b == 0) {
    return a;
  }
  return gcd(b, a % b);
}
bool comp2(pair<pair<long long, long long>, long long> a,
           pair<pair<long long, long long>, long long> b) {
  if (a.first.first == b.first.first) return a.second < b.second;
  return (a.first.first < b.first.first);
}
bool comp1(pair<long long, long long> a, pair<long long, long long> b) {
  return a.first < b.first;
}
long long spf[1000001];
void init1() {
  for (long long i = 2; i <= 1000000; i++) {
    if (spf[i] == i) {
      for (long long j = i * i; j <= 1000000; j += i) {
        spf[j] = min(spf[j], i);
      }
    }
  }
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  for (long long i = 1; i <= 1000000; i++) spf[i] = i;
  init1();
  long long ans[1000001];
  ans[1] = 1;
  ans[2] = 2;
  ans[3] = 3;
  ans[4] = 2;
  long long v = 2;
  for (long long i = 5; i <= 1000000; i++) {
    long long val = i;
    v++;
    long long sub1 = 0;
    long long subc = 1;
    while (val != 1) {
      long long x = spf[val];
      long long f = i / x;
      if (f == x) {
        subc++;
      } else if ((f) > (x)) {
        sub1 = 1;
      }
      while (val % x == 0) val /= x;
    }
    if (subc > 1)
      v -= subc;
    else if (sub1 == 1)
      v--;
    ans[i] = v;
  }
  long long t;
  cin >> t;
  while (t--) {
    long long x;
    cin >> x;
    cout << ans[x] << '\n';
  }
}
