#include <fstream>
using namespace std;
int main()
{
    ifstream f1("soht.inp");
    ofstream f2("soht.out");
    int i,j;
    f1 >> i;
    f1.close();
    for (int n = 1; n < i; n++)
    {
        j = 0;
        for (int m = 1; m < n; m++)
        {
            if (n%m==0) j = j + m;
        }
        if (j==n) f2 << n;
    }
    f2.close();
    return 0;
}
