#include <bits/stdc++.h>
using namespace std;
bool is_composite[1000005];
int pref[1000005];
void sieve(int n) {
  for (int i = 2; i <= n; ++i)
    for (int j = i + i; j <= n; j += i) is_composite[j] = true;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int t;
  cin >> t;
  is_composite[1] = false;
  sieve(1000000);
  for (int i = 1; i <= 1000000; ++i) pref[i] = pref[i - 1] + !is_composite[i];
  while (t--) {
    int n;
    cin >> n;
    cout << 1 + pref[n] - pref[int(sqrt(n))] << '\n';
  }
}
