#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")
using namespace std;
const int mod = (int)1e9 + 7;
const int N = 1e5 + 10;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t;
  cin >> t;
  const int N = 1e6 + 10;
  long long spf[N + 10];
  vector<bool> visit(N + 10);
  for (int i = 1; i < N; i++) {
    spf[i] = i;
  }
  for (int i = 2; i * i < N; i++) {
    if (spf[i] == i) {
      for (int j = i * i; j < N; j += i) {
        if (spf[j] == j) {
          spf[j] = i;
          visit[i] = true;
          visit[j] = true;
        }
      }
    }
  }
  vector<int> res(N + 100);
  for (int i = 1; i <= N; i++) {
    if (spf[i] == i) res[i] += 1;
    res[i] += res[i - 1];
  }
  while (t--) {
    int n;
    cin >> n;
    int ans = res[n] - res[sqrt(n)] + 1;
    cout << ans << "\n";
  }
}
