#include <bits/stdc++.h>
using namespace std;
const int maxN = 1e6 + 10;
bool used[maxN];
vector<int> p;
void init() {
  for (int i = 2; i < maxN; ++i) {
    if (!used[i]) {
      p.push_back(i);
      for (int j = i; j < maxN; j += i) used[j] = 1;
    }
  }
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  init();
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    auto itL = upper_bound(p.begin(), p.end(), sqrt(n)) - p.begin();
    auto itR = upper_bound(p.begin(), p.end(), n) - p.begin();
    cout << itR - itL + 1 << "\n";
  }
  return 0;
}
