#include <bits/stdc++.h>
using namespace std;
int mp2[1000010], mp[1000010];
void hope() {
  int j;
  int p;
  p = 3;
  int ct = 1;
  for (int i = 2; i <= 1000005; i++) {
    if (mp[i] != 7) {
      ct++;
    }
    if (mp[i] != 7) {
      for (j = i; j <= 1000005; j += i) mp[j] = 7;
    }
    mp2[i] = ct;
  }
}
int main() {
  int t, n, k, ct = 0;
  hope();
  cin >> t;
  while (t--) {
    scanf("%d", &n);
    k = sqrt(n);
    if (n <= 3) {
      cout << n << endl;
    } else {
      printf("%d\n", mp2[n] - mp2[k] + 1);
    }
  }
  return 0;
}
