#include <bits/stdc++.h>
using namespace std;
long long int power(long long int x, long long int y);
long long int gcd(long long int a, long long int b);
vector<long long int> ft = {0};
long long int modInv(long long int i) { return power(i, 1000000007 - 2); }
long long int ncr(long long int n, long long int r) {
  return (n >= r ? (ft[n] * modInv(ft[r])) % 1000000007 * modInv(ft[n - r]) %
                       1000000007
                 : 0);
}
long long int power(long long int x, long long int y) {
  long long int res = 1;
  x %= 1000000007;
  while (y > 0) {
    if (y & 1) res = (res * x) % 1000000007;
    y = y >> 1;
    x = (x * x) % 1000000007;
  }
  return res % 1000000007;
}
long long int gcd(long long int a, long long int b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
const long long int maxN = 1000001;
long long int prime[maxN];
vector<long long int> v, v1;
void sieve() {
  for (long long int i = 2; i < maxN; i++) {
    if (prime[i] == 0) {
      v.push_back(i * i);
      v1.push_back(i);
      for (long long int j = i * i; j < maxN; j += i) {
        prime[j] = 1;
      }
    }
  }
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  sieve();
  long long int t;
  cin >> t;
  while (t--) {
    long long int n;
    cin >> n;
    long long int ans = 1;
    auto up = upper_bound(v.begin(), v.end(), n);
    auto up1 = upper_bound(v1.begin(), v1.end(), n);
    long long int temp = up - v.begin();
    long long int temp2 = up1 - v1.begin();
    cout << ans + temp2 - temp << "\n";
  }
}
