#include <bits/stdc++.h>
using namespace std;
const long long N = 1e6 + 5;
vector<long long> upto(N);
void pre() {
  for (long long i = 2; i < N; i++) upto[i] = 1;
  for (long long i = 2; i * i < N; i++) {
    if (upto[i]) {
      for (long long j = i * i; j < N; j += i) upto[j] = 0;
    }
  }
  for (long long i = 1; i < N; i++) upto[i] += upto[i - 1];
}
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  pre();
  long long T = 1;
  cin >> T;
  while (T--) {
    long long n;
    cin >> n;
    long long res = upto[n] - upto[sqrt(n)];
    cout << ++res << '\n';
  }
  return 0;
}
