importPackage(java.io);
importPackage(java.lang);
var reader = new BufferedReader( new InputStreamReader(System['in']) );
var limit = reader.readLine();
for(i = 7; i < limit; ++i) {
if(!isConstructible(i))
System.out.print(parseInt(i) + " ");
}
function isConstructible(n) {
while(n%2 == 0)
n >>= 1;
return n == 1 || n == 3 || n == 5 || n == 17 || n == 257 || n == 65537;
}
aW1wb3J0UGFja2FnZShqYXZhLmlvKTsKaW1wb3J0UGFja2FnZShqYXZhLmxhbmcpOwoKdmFyIHJlYWRlciA9IG5ldyBCdWZmZXJlZFJlYWRlciggbmV3IElucHV0U3RyZWFtUmVhZGVyKFN5c3RlbVsnaW4nXSkgKTsKdmFyIGxpbWl0ID0gcmVhZGVyLnJlYWRMaW5lKCk7Cgpmb3IoaSA9IDc7IGkgPCBsaW1pdDsgKytpKSB7CglpZighaXNDb25zdHJ1Y3RpYmxlKGkpKQoJCVN5c3RlbS5vdXQucHJpbnQocGFyc2VJbnQoaSkgKyAiICIpOwp9CgpmdW5jdGlvbiBpc0NvbnN0cnVjdGlibGUobikgewoJCXdoaWxlKG4lMiA9PSAwKQoJCQluID4+PSAxOwoJCXJldHVybiBuID09IDEgfHwgbiA9PSAzIHx8IG4gPT0gNSB8fCBuID09IDE3IHx8IG4gPT0gMjU3IHx8IG4gPT0gNjU1Mzc7Cn0=