#include <bits/stdc++.h>
using namespace std;
long long siv[1000006];
long long prime[1000006];
void seive() {
  for (long long i = 2; i < 1000006; i++) {
    prime[i] = prime[i - 1];
    if (!siv[i]) {
      prime[i]++;
      for (long long j = i + i; j < 1000006; j += i) siv[j] = 1;
    }
  }
}
void solve() {
  long long t;
  t = 1;
  cin >> t;
t:
  seive();
  while (t--) {
    long long n;
    cin >> n;
    long long a = sqrt(n);
    cout << prime[n] - prime[a] + 1 << "\n";
  }
}
int main() {
  {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
  }
  solve();
  return 0;
}
