#include <bits/stdc++.h>
using namespace std;
long long intceil(long long a, long long b) { return (a + b - 1 * 1ll) / b; }
const int N = (int)1e6 + 7;
vector<int> dp(N, 0);
vector<char> prime(N, true);
void solve() {
  int n;
  cin >> n;
  cout << dp[n] << '\n';
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  cin >> t;
  dp[1] = 1;
  dp[2] = 2;
  dp[3] = 3;
  vector<long long> prost;
  prime[0] = prime[1] = false;
  for (long long i = 2; i <= N; ++i)
    if (prime[i])
      if (i * 1ll * i <= N)
        for (long long j = i * i; j <= N; j += i) prime[j] = false;
  for (long long i = 2; i <= 1300; i++) {
    if (prime[i]) prost.push_back(i);
  }
  int cur = 0;
  for (long long i = 4; i <= N; i++) {
    if (i == prost[cur] * prost[cur]) {
      dp[i] = dp[i - 1] - 1;
      cur++;
    } else {
      if (prime[i]) {
        dp[i] = dp[i - 1] + 1;
      } else {
        dp[i] = dp[i - 1];
      }
    }
  }
  while (t--) {
    solve();
  }
  return 0;
}
