#include <bits/stdc++.h>
const double pi = acos(-1.0);
const int maxn = (5e2 + 10);
const int inf = 0x3f3f3f3f;
const long long mod = 1e9 + 7;
using namespace std;
int sum = 0, prime[3000010], pd[3000010];
void getprime() {
  memset(pd, false, sizeof(pd));
  for (int i = 2; i <= 1000000; i++) {
    if (pd[i] == false) {
      sum += 1;
      prime[sum] = i;
    }
    for (int j = 2; j * i <= 1000000; j++) pd[j * i] = true;
  }
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int t;
  cin >> t;
  getprime();
  while (t--) {
    long long n;
    cin >> n;
    int xl1 = upper_bound(prime + 1, prime + 1 + sum, sqrt(n)) - prime;
    int xl2 = upper_bound(prime + 1, prime + 1 + sum, n) - prime;
    cout << xl2 - xl1 + 1 << '\n';
  }
  return 0;
}
