uses crt;
var n,i:longint;
function perfect(n:longint):boolean;
var i,ans:longint;
begin
ans:=0;
for i:=1 to n div 2 do
if(n mod i = 0) then inc(ans,i);
exit(ans = n);
end;
begin
clrscr;
readln(n);
for i:=1 to n - 1 do
if(perfect(i)) then write(i,' ');
readln;
end.