#include <bits/stdc++.h>
using namespace std;
using ld = long double;
using vi = vector<long long>;
using vs = vector<string>;
using mi = map<long long, long long>;
using pi = pair<long long, long long>;
using vvi = vector<vi>;
using vvvi = vector<vector<vi> >;
const long long N = 1000005;
const long long mod = 1e9 + 7;
const long long inf = 1e18 + 1;
vector<bool> isPrime(N, true);
vector<long long> ans(N, 0);
void pre() {
  for (long long i = 2; i * i <= N; i++) {
    if (isPrime[i]) {
      for (long long j = i * i; j <= N; j += i) {
        isPrime[j] = false;
      }
    }
  }
  ans[1] = 1;
  for (long long i = 2; i < N; i++) {
    ans[i] = ans[i - 1] + (isPrime[i]);
  }
}
void solve() {
  long long n;
  cin >> n;
  cout << ans[n] - ans[sqrt(n)] + 1;
}
int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  pre();
  long long t = 1;
  cin >> t;
  while (t--) {
    solve();
    cout << "\n";
  }
  return 0;
}
