#include <bits/stdc++.h>
using namespace std;
const long long N = 1e6;
const long long mod = 1e9 + 7;
vector<long long> primes;
bool not_prime[N];
void sieve_of_eratosthenes(long long n) {
  for (long long i = 2; i < N; i++) {
    if (not_prime[i]) continue;
    primes.push_back(i);
    for (long long j = 2 * i; j < N; j += i) {
      not_prime[j] = 1;
    }
  }
}
void solve() {
  long long n;
  cin >> n;
  long long ans = upper_bound(primes.begin(), primes.end(), n) - primes.begin();
  ans += 1;
  long long sq = sqrt(n);
  ans -= (upper_bound(primes.begin(), primes.end(), sq) - primes.begin());
  cout << ans;
}
int32_t main() {
  sieve_of_eratosthenes(1e6);
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t = 1;
  cin >> t;
  while (t--) {
    solve();
    cout << "\n";
  }
  return 0;
}
