#include<iostream>
#include<algorithm>
#include<cmath>
#include<string>
#include<cstring>
#include<cstdio>
const int maxn=1e4+5;
using namespace std;
int main()
{
int a[maxn];
a[1]=0;
for(int i=2;i<=1005;++i)
{
int f=1;
for(int j=2;j<=sqrt(i);++j)
{
if(i%j==0)
{
a[i]=a[i-1];
f=0;
break;
}
}
if(f==1) a[i]=a[i-1]+1;
//printf("%d\n",a[i-1]);
}
int n,t;
cin>>t;
while(t--)
{
scanf("%d",&n);
printf("%d\n",a[n]-a[2]+1);
}
}