#include<cstdio>
#include<algorithm>
#include<string>
#include<cstring>
#include<cmath>
#include<iostream>
#include<set>
#include<stdlib.h>
#include<vector>
using namespace std;
const int maxn=110;
const int inf=0x3f3f3f3f;
int jg(int n){
if(n%2==0)return 0;
int l=sqrt(n)+1;
for(int i=3;i<=l;i+=2){
if(n%i==0)return 0;
}
return 1;
}
vector<int>s;
int main(){
int T;
scanf("%d",&T);
int flag=0;
for(int i=3;i<=1000;i++){
if(jg(i)==1){
s.push_back(i);
flag++;
}
}
while(T--){
int n;
scanf("%d",&n);
int sum=0;
for(int i=0;i<=167;i++){
if(s[i]<=n){
sum++;
}
}
printf("%d\n",sum);
}
}