#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 1000;
const int inf = 0x3f3f3f3f;
const int mod = 1e9 + 7;
bool prime[maxn];
long long ans[maxn];
int main() {
  ios::sync_with_stdio(false);
  for (int i = 2; i <= 1e6; i++) {
    if (prime[i]) continue;
    for (int j = i + i; j <= 1e6; j += i) prime[j] = true;
  }
  ans[1] = 1;
  for (int i = 2; i <= 1000000; i++) {
    if (prime[i]) continue;
    ans[i] = 1;
    if ((long long)i * i <= 1000000) ans[i * i]--;
  }
  for (int i = 2; i <= 1000000; i++) {
    ans[i] += ans[i - 1];
  }
  int t, n;
  scanf("%d", &t);
  while (t--) {
    scanf("%d", &n);
    printf("%lld\n", ans[n]);
  }
  return 0;
}
