#include <bits/stdc++.h>
using namespace std;
const int dx[] = {-1, -1, -1, 0, 0, 0, 1, 1, 1};
const int dy[] = {-1, 0, 1, -1, 0, 1, -1, 0, 1};
void AIA() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
bool isprime(long long n) {
  for (long long i = 2; i * i <= n; i++) {
    if (n % i == 0) return 0;
  }
  return (n != 1);
}
long long gcd(long long x, long long y) { return (y == 0 ? x : gcd(y, x % y)); }
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
long long rem(int x, int N) { return (x % N + N) % N; }
long long fre[1000007];
void fil() {
  fre[1] = 1;
  for (long long i = 2; i < 1000007; i++) {
    if (isprime(i)) {
      fre[i] = 1;
      if (i * i < 1000007) {
        fre[i * i] = -1;
      }
    }
  }
  for (int i = 1; i < 1000007; i++) {
    fre[i] += fre[i - 1];
  }
}
void solve() {
  long long n;
  cin >> n;
  cout << fre[n] << "\n";
}
int main() {
  AIA();
  fil();
  int t;
  cin >> t;
  for (int T = 1; T <= t; T++) {
    solve();
  }
  return 0;
}
