#include <bits/stdc++.h>
using namespace std;
vector<int> primes;
const int N = 1e6 + 4;
bool isp[N];
void sieve() {
  fill(isp + 2, isp + N, 1);
  for (int i = 2; i < N; i++) {
    if (!isp[i]) continue;
    primes.push_back(i);
    for (int j = 2 * i; j < N; j += i) isp[j] = false;
  }
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  sieve();
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    int ans = 1, rt = sqrt(n);
    ans += upper_bound(primes.begin(), primes.end(), n) - primes.begin();
    ans -= upper_bound(primes.begin(), primes.end(), rt) - primes.begin();
    cout << ans << "\n";
  }
}
