#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9 + 7;
const int mod = 1000000007;
const int maxn = 1e6 + 3;
long long prime[1000006];
long long exp(long long a, long long b);
void sieve(long long n);
long long gcd(long long a, long long b);
long long countdigit(long long n);
long long check(string str);
vector<long long> ft;
long long mul(long long a, long long b) {
  long long ans = ((a % mod) * (b % mod)) % mod;
  return ans % mod;
}
long long sub(long long a, long long b) {
  long long ans = (a - b + mod) % mod;
  return ans;
}
long long sum(long long a, long long b) {
  long long ans = (a + b) % mod;
  return ans;
}
long long digits_in_binary(long long number) {
  return (long long)log2(number) + 1;
}
bool gun(long long n) {
  if (n == 0) return false;
  return (ceil(log2(n)) == floor(log2(n)));
}
long long fun(long long x) {
  if (x == 0 || x == 1) return x;
  long long start = 1, end = x, ans;
  while (start <= end) {
    long long mid = (start + end) / 2;
    if (mid * mid == x) return mid;
    if (mid * mid < x) {
      start = mid + 1;
      ans = mid;
    } else
      end = mid - 1;
  }
  return ans;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long t = 1;
  sieve(1000006);
  long long freq[1000006] = {0};
  for (int i = 0; i < 1000006; i++) {
    if (prime[i] == 1) {
      freq[i] = freq[i - 1] + 1;
    } else {
      freq[i] = freq[i - 1];
    }
  }
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    long long d = fun(n);
    long long c1 = 0, c2 = 0;
    c1 = freq[d];
    c2 = freq[n];
    cout << c2 - c1 + 1 << '\n';
  }
}
long long exp(long long a, long long b) {
  int res = 1;
  while (b) {
    if (b & 1) res = (res * a) % mod;
    a = (a * a) % mod;
    b >>= 1;
  }
  return res % mod;
}
long long gcd(long long a, long long b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
void sieve(long long n) {
  for (long long i = 0; i <= n; i++) {
    prime[i] = 1;
  }
  prime[0] = 0;
  prime[1] = 0;
  for (long long i = 2; i <= n; i++) {
    if (prime[i] == 1) {
      for (long long j = 2; i * j <= n; j++) {
        prime[i * j] = 0;
      }
    }
  }
}
long long countdigit(long long n) { return floor(log10(n) + 1); }
long long check(string str) {
  long long l = 0;
  long long h = str.size() - 1;
  while (h > l) {
    if (str[l++] != str[h--]) {
      return 0;
    }
  }
  return 1;
}
