#include <bits/stdc++.h>
using namespace std;
long long int bexp(long long int a, long long int b, long long int mod) {
  long long int res = 1;
  while (b) {
    if (b & 1) res = (res * a) % mod;
    a = (a * a) % mod;
    b >>= 1;
  }
  return res;
}
long long int gcd(long long int a, long long int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
const long long int N = 1000010;
const long long int mod = 1e9 + 7;
struct comp {
  bool operator()(const pair<long long int, long long int> a,
                  const pair<long long int, long long int> b) const {
    return a.second > b.second;
  }
};
long long int dp[N] = {}, prime[N] = {};
int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.precision(10);
  long long int t;
  cin >> t;
  dp[1] = 1;
  prime[1] = 1;
  long long int cnt = 1;
  for (long long int i = 2; i < N; ++i) {
    if (prime[i] == 0) {
      cnt++;
      for (long long int j = i * i; j < N; j += i) {
        prime[j] = 1;
      }
    }
    long long int k = sqrt(i);
    if (k * k == i && prime[k] == 0) {
      cnt--;
    }
    dp[i] = cnt;
  }
  for (long long int i = 0; i < t; ++i) {
    long long int n;
    cin >> n;
    cout << dp[n] << "\n";
  }
  return 0;
}
