#include <iostream>
#include <cmath>
using namespace std;
int main() {
unsigned long long M;
cin >> M;
for (unsigned long long n = 4; n <= M; n += 2) {
unsigned long long S = 1;
for (unsigned long long j = 2; j <= sqrt(n) && S <= n; j++) {
if (n % j == 0) S += n / j + j;
}
if (n == S) cout << n << " ";
}
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8Y21hdGg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgppbnQgbWFpbigpIHsJCgl1bnNpZ25lZCBsb25nIGxvbmcgTTsKCWNpbiA+PiBNOwogCWZvciAodW5zaWduZWQgbG9uZyBsb25nIG4gPSA0OyBuIDw9IE07IG4gKz0gMikgewogCQl1bnNpZ25lZCBsb25nIGxvbmcgUyA9IDE7CgkgICAgZm9yICh1bnNpZ25lZCBsb25nIGxvbmcgaiA9IDI7IGogPD0gc3FydChuKSAmJiBTIDw9IG47IGorKykgewoJCQlpZiAobiAlIGogPT0gMCkgUyArPSBuIC8gaiArIGo7CgkJfQoJCWlmIChuID09IFMpIGNvdXQgPDwgbiA8PCAiICI7Cgl9CglyZXR1cm4gMDsKfQ==