#include <bits/stdc++.h>
using namespace std;
void __print(int x) { cerr << x; }
void __print(long x) { cerr << x; }
void __print(long long x) { cerr << x; }
void __print(unsigned x) { cerr << x; }
void __print(unsigned long x) { cerr << x; }
void __print(unsigned long long x) { cerr << x; }
void __print(float x) { cerr << x; }
void __print(double x) { cerr << x; }
void __print(long double x) { cerr << x; }
void __print(char x) { cerr << '\'' << x << '\''; }
void __print(const char *x) { cerr << '\"' << x << '\"'; }
void __print(const string &x) { cerr << '\"' << x << '\"'; }
void __print(bool x) { cerr << (x ? "true" : "false"); }
template <typename T, typename V>
void __print(const pair<T, V> &x) {
  cerr << '{';
  __print(x.first);
  cerr << ',';
  __print(x.second);
  cerr << '}';
}
template <typename T>
void __print(const T &x) {
  int f = 0;
  cerr << '{';
  for (auto &i : x) cerr << (f++ ? "," : ""), __print(i);
  cerr << "}";
}
void _print() { cerr << "]\n"; }
template <typename T, typename... V>
void _print(T t, V... v) {
  __print(t);
  if (sizeof...(v)) cerr << ", ";
  _print(v...);
}
template <typename T>
void print(vector<vector<T>> v) {
  for (int i = 0; i < (int)v.size(); ++i) {
    cout << i << " : ";
    for (int j = 0; j < (int)v[i].size(); ++j) {
      cout << v[i][j] << " ";
    }
    cout << endl;
  }
  cout << endl;
}
template <typename T>
void arr(T *a, int n) {
  for (int i = 0; i < n; ++i) {
    cout << a[i] << " ";
  }
  cout << endl;
}
int power_mod(long long a, long long b, long long mod) {
  int ans = 1;
  while (b) {
    if (b & 1) {
      ans = (ans * a) % mod;
    }
    a = (a * a) % mod;
    b /= 2;
  }
  return ans;
}
long long const nax = 1e6 + 11;
long long p[nax];
long long prime[nax];
long long d[nax];
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  for (long long i = 2; i < nax; ++i) {
    if (p[i] == 0) {
      if (i * i < nax) {
        prime[i * i]++;
      }
      d[i] = 1;
      for (long long j = i; j < nax; j += i) p[j] = 1;
    }
  }
  for (long long i = 1; i < nax; ++i)
    prime[i] += prime[i - 1], d[i] += d[i - 1];
  long long tc;
  cin >> tc;
  while (tc--) {
    long long N;
    cin >> N;
    cout << (d[N] - prime[N]) + 1 << "\n";
  }
}
