#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 10;
int primes[maxn], cnt = 0, sum[maxn];
bool st[maxn];
inline void read(int& x) {
  x = 0;
  int ch = getchar();
  for (; !isdigit(ch); ch = getchar())
    ;
  for (; isdigit(ch); ch = getchar()) {
    x = x * 10 + ch - '0';
  }
}
inline void init() {
  cnt = 0;
  for (int i = 2; i < maxn; ++i) {
    if (!st[i]) primes[++cnt] = i;
    for (int j = 1; primes[j] * i < maxn; ++j) {
      st[primes[j] * i] = 1;
      if (i % primes[j] == 0) break;
    }
  }
}
int main() {
  init();
  for (int i = 1; i < maxn; ++i) {
    sum[i] = sum[i - 1] + !st[i];
  }
  int T;
  read(T);
  while (T--) {
    int n;
    read(n);
    int ans = 1;
    int l = 1, r = cnt;
    int pos = -1;
    while (l <= r) {
      int mid = (l + r) >> 1;
      long long p = primes[mid];
      if (p * p > n) {
        pos = mid;
        r = mid - 1;
      } else {
        l = mid + 1;
      }
    }
    l = 1, r = cnt;
    int p2 = -1;
    while (l <= r) {
      int mid = (l + r) >> 1;
      if (primes[mid] > n) {
        p2 = mid;
        r = mid - 1;
      } else {
        l = mid + 1;
      }
    }
    ans += p2 - pos;
    printf("%d\n", ans);
  }
  return 0;
}
