#include<iostream> using namespace std; int main() { int n,x,p1,p2,d; cin>>n; for(x=1;x<=n;x++) { p1=1; if(x-1==0 || x-1==1) p1=0; else for(d=2;d<=(x-1)/2;d++) if((x-1)%d==0) p1=0; p2=1; for(d=2;d<=(x+1)/2;d++) if((x+1)%d==0) p2=0; if(p1==1 && p2==1) cout<<x<<" "; } return 0; }