#include <bits/stdc++.h>
using namespace std;
long long a[2000000], b[2000000];
bool prime[2000000];
set<long long> st;
void SieveOfEratosthenes(int n) {
  long long ans = 1;
  memset(prime, true, sizeof(prime));
  for (int p = 2; p * p <= n; p++) {
    if (prime[p] == true) {
      for (int i = p * p; i <= n; i += p) prime[i] = false;
    }
  }
  a[0] = 1;
  long long k = 0, j = 0;
  for (int p = 2; p <= n; p++) {
    if (prime[p]) {
      ans++;
      b[k++] = p;
    } else if (b[j] * b[j] == p) {
      j++;
      ans--;
    }
    a[p - 1] = ans;
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n = 1e6, tt;
  SieveOfEratosthenes(n);
  cin >> tt;
  while (tt--) {
    cin >> n;
    cout << a[n - 1] << '\n';
  }
  return 0;
}
