#include <bits/stdc++.h>
using namespace std;
const int N = 1e6;
int p[N], s[N];
void fun() {
  for (int i = 2; i <= N; i++) {
    if (!p[i]) {
      for (int j = i + i; j <= N; j += i) p[j] = 1;
    }
    s[i] = s[i - 1] + 1 - p[i];
  }
  return;
}
void solve() {
  int n;
  scanf("%d", &n);
  int ind = sqrt(n);
  printf("%d\n", s[n] - s[ind] + 1);
  return;
}
int main() {
  int t = 1;
  scanf("%d", &t);
  fun();
  while (t--) {
    solve();
  }
  return 0;
}
