#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int n, m, k, q;
const int INF = 1e9 + 5;
const int nax = 1e5 + 5;
int rs[10 * nax];
void solve() {
  cin >> n;
  cout << rs[n] << "\n";
}
int main() {
  {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
  };
  rs[1] = 1;
  for (int i = 2; i <= 1e6; ++i) {
    if (!rs[i]) {
      rs[i] = 1;
      int j = 2;
      while (j * i <= 1e6) {
        if (j == i)
          rs[j * i] = -1;
        else
          rs[j * i] = -69;
        j++;
      }
    }
  }
  for (int i = 1; i <= 1e6; ++i) {
    if (rs[i] == -69) rs[i] = 0;
    rs[i] += rs[i - 1];
  }
  int t = 1;
  cin >> t;
  while (t--) {
    solve();
  }
}
