#include <bits/stdc++.h>
using namespace std;
int A[100010];
int S[100010];
int main() {
	int s = 0;
	S[1] = 0;
	for(int i = 2; i < 100001; i++) {
		S[i] = S[i - 1];
		for(int i2 = i * 2; i2 < 100001; i2 += i) {
			A[i2] += 1;
		}
		if (A[i] >= 3) S[i] ++;
	}
	
	int N;
	cin >> N;
	for(int n = 0; n < N; n++) {
		int i;
		cin >> i;
		cout << S[i] << endl;
	}
}
