#include <bits/stdc++.h>
using namespace std;
const long long maxn = 1000006;
bool prime[maxn + 1];
long long dp[1000006] = {0};
void sieve() {
  memset(prime, true, sizeof(prime));
  for (long long p = 2; p * p <= maxn; p++) {
    if (prime[p] == true) {
      for (long long i = p * p; i <= maxn; i += p) prime[i] = false;
    }
  }
  dp[1] = 1;
  long long val = 0;
  for (long long i = 2; i <= maxn; i++) {
    long long cost = 0;
    if (dp[i] == 1) --cost;
    if (prime[i]) {
      ++cost;
      if (i * i <= maxn) dp[i * i]++;
    }
    dp[i] = (dp[i - 1] + cost);
  }
}
int32_t main() {
  sieve();
  long long t;
  scanf("%lld", &t);
  while (t--) {
    long long n;
    scanf("%lld", &n);
    printf("%lld\n", dp[n]);
  }
}
