#include<iostream>
using namespace std;
bool chkPrime(int i){
if (i==1){
return false;
}
else {
for (int j=2; j*j <= i; j++)
{
if (i%j == 0){
return false;
}
}
}
return true;
}
void prime(int n){
for (int i = 1; i <= n; i++)
{
if(chkPrime(i))
{
cout<<i<<" ";
}
}
}
int main(){
int n;
cin>>n;
prime(n);
return 0;
}
I2luY2x1ZGU8aW9zdHJlYW0+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7Cgpib29sIGNoa1ByaW1lKGludCBpKXsKICAgIGlmIChpPT0xKXsKICAgICAgICByZXR1cm4gZmFsc2U7ICAKICAgIH0KIAogICAgZWxzZSB7CiAgICAgICAgZm9yIChpbnQgaj0yOyBqKmogPD0gaTsgaisrKQogICAgICAgIHsKICAgICAgICAgICAgaWYgKGklaiA9PSAwKXsKICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgIH0KICAgIHJldHVybiB0cnVlOwoKfQoKdm9pZCBwcmltZShpbnQgbil7CiAgICBmb3IgKGludCBpID0gMTsgaSA8PSBuOyBpKyspCiAgICB7CiAgICAgICAgaWYoY2hrUHJpbWUoaSkpCiAgICAgICAgewogICAgICAgICAgICBjb3V0PDxpPDwiICI7CiAgICAgICAgfQogICAgfQogICAgCn0KCmludCBtYWluKCl7CiAgICBpbnQgbjsKICAgIGNpbj4+bjsKICAgIAogICAgcHJpbWUobik7CgogICAgcmV0dXJuIDA7Cn0=