#include <iostream>
#include <vector>
using namespace std;

//判断完数
int Sum(int k) {
    int sum = 0;
    for (int i = 1; i < k; i++) {
        if (k % i == 0) {
            sum += i;
        }
    }
    return sum;
}



int main() {
    vector<int> eiVector; //完数
    int n;
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) {
        if (i == Sum(i)) {
            eiVector.push_back(i);
        }
    }
    for (int i = 0; i < eiVector.size(); i++) {
        printf("%d ", eiVector[i]);
    }
    
}