#include <bits/stdc++.h>
using namespace std;
bool check[1000000 + 1];
vector<int> v;
void sangnt() {
  for (int i = 2; i <= 1e6; i++) {
    check[i] = true;
  }
  for (int i = 2; i <= 1e6; i++) {
    if (check[i] == true) {
      v.push_back(i);
      for (long long j = 1ll * i * i; j <= 1e6; j += i) {
        check[j] = false;
      }
    }
  }
}
int main() {
  ios_base::sync_with_stdio(NULL);
  cin.tie(NULL);
  cout.tie(NULL);
  if (fopen(""
            ".inp",
            "r")) {
    freopen(
        ""
        ".inp",
        "r", stdin);
    freopen(
        ""
        ".out",
        "w", stdout);
  }
  int t, n;
  cin >> t;
  sangnt();
  while (t--) {
    cin >> n;
    int ans = 1;
    int k = upper_bound(v.begin(), v.end(), n) - v.begin();
    ans += max(0, k);
    for (auto x : v) {
      if (x > sqrt(n)) break;
      if (1ll * x * x <= n) --ans;
    }
    cout << ans << '\n';
  }
  return 0;
}
