#include <bits/stdc++.h>
#define N (long long)(1e5)
using namespace std;

long long q;
vector<long long> sum;

void prepair();
void solve();

int main() {
  cin >> q;
  prepair();
  solve();
  return 0;
}

void prepair() {
  sum.assign(N + 1, 0);
  for(int i = 2; i <= N; ++i) {
    sum[i] = sum[i - 1];
    long long cnt = 0;
    for(long long j = 2; j * j <= i; ++j)
      if(i % j == 0) ++cnt;
    if(cnt >= 2) ++sum[i];
  }
}
void solve() {
  for(int i = 0; i < q; ++i) {
    int n;
    cin >> n;
    cout << sum[n] << endl;
  }
}
