#include<bits/stdc++.h>
using namespace std;
int main(){
int l;
int i,k;
int s=0,num=0;
bool b=true;
cin>>l;
for(k=2;k<=l;k++){
if(k==2||k==3){
cout<<k<<endl;
s+=k;
num+=1;
b=false;
}
if(k%2==0||k==1||k==0){
b=false;
}
for(int i=3;i<sqrt(k);i+=2){
if(k%i==0){
b=false;
}
}
if(s>l){
break;
}
if(b){
cout<<k<<endl;
s+=k;
num+=1;
}
}
cout<<num;
return 0;
}