var simple: List<integer> := new List<integer>; i, n, p: integer; m: longint;
begin read(n); for i := 2 to n do begin m := 1; foreach s: integer in simple do m := m * i mod s; if m > 0 then begin simple.Add(i); // write(i, ' '); end; end; writeln();
foreach s: integer in simple do begin if Math.Pow(2, s) - 1 <= longint.MaxValue then begin m := round(Math.Pow(2, s) - 1); if (m <= n) and simple.Contains(m) then write(m, ' '); end; end; end.
System.Collections.Generic,
System;
var
simple: List<integer> := new List<integer>;
i, n, p: integer;
m: longint;
begin
read(n);
for i := 2 to n do
begin
m := 1;
foreach s: integer in simple do
m := m * i mod s;
if m > 0 then begin
simple.Add(i);
// write(i, ' ');
end;
end;
writeln();
foreach s: integer in simple do
begin
if Math.Pow(2, s) - 1 <= longint.MaxValue then begin
m := round(Math.Pow(2, s) - 1);
if (m <= n) and simple.Contains(m) then
write(m, ' ');
end;
end;
end.