#include <bits/stdc++.h>
using namespace std;
int prime[2000000], su[2000000];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  for (int i = 2; i * i <= 1000000; i++) {
    if (prime[i]) continue;
    for (int j = 2 * i; j <= 1000000; j += i) prime[j] = 1;
  }
  for (int i = 2; i <= 1000000; i++) su[i] = su[i - 1] + (1 - prime[i]);
  int t;
  cin >> t;
  for (int o = 0; o < t; o++) {
    int n;
    cin >> n;
    int hi = sqrt(n);
    cout << su[n] - su[hi] + 1 << '\n';
  }
  return 0;
}
