#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll Maxn=1000000+10;
int prim[Maxn+100],used[Maxn+100],ans;
void solve(){
for(long long i=2;i<Maxn;i++){
if(!used[i]){
prim[ans++]=i;
}
for(long j=0;j<ans;j++){
if(i*prim[j]>Maxn){
break;
}
used[prim[j]*i]=1;
if(i%prim[j]==0){
break;
}
}
}
}
main()
{
memset(used,0,sizeof(used));
ans = 0;
used[1]=1;
solve();
cout<<ans<<endl;
cout<<prim[ans-1]<<endl;
int n;
while(~scanf("%d",&n)){
int pos = lower_bound(prim,prim+ans,n)-prim;
for(int i=pos ;i<ans ;i++){
// cout<<used[i+1]<<" "<<i+1<<" "<<prim[i]<<endl;
if(!used[i+1]){
cout<<prim[i]<<endl;
break;
}
}
}
}
using namespace std;
typedef long long ll;
const ll Maxn=1000000+10;
int prim[Maxn+100],used[Maxn+100],ans;
void solve(){
for(long long i=2;i<Maxn;i++){
if(!used[i]){
prim[ans++]=i;
}
for(long j=0;j<ans;j++){
if(i*prim[j]>Maxn){
break;
}
used[prim[j]*i]=1;
if(i%prim[j]==0){
break;
}
}
}
}
main()
{
memset(used,0,sizeof(used));
ans = 0;
used[1]=1;
solve();
cout<<ans<<endl;
cout<<prim[ans-1]<<endl;
int n;
while(~scanf("%d",&n)){
int pos = lower_bound(prim,prim+ans,n)-prim;
for(int i=pos ;i<ans ;i++){
// cout<<used[i+1]<<" "<<i+1<<" "<<prim[i]<<endl;
if(!used[i+1]){
cout<<prim[i]<<endl;
break;
}
}
}
}