#include <bits/stdc++.h>
using namespace std;
const int N = (int)1e6 + 3;
const long long INFF = (long long)1e18;
int cnt[N];
bool ck[N];
int main() {
  for (int i = 2; i < N; i++) {
    if (ck[i]) continue;
    for (int j = i; j < N; j += i) ck[j] = true;
    cnt[i]++;
    if (i <= 1000) {
      cnt[i * i]--;
    }
  }
  cnt[1] = 1;
  for (int i = 1; i < N; i++) cnt[i] += cnt[i - 1];
  int t;
  scanf("%d", &t);
  while (t--) {
    int n;
    scanf("%d", &n);
    printf("%d\n", cnt[n]);
  }
  return 0;
}
