uses crt;
var n,i,s,d:integer;
function chuso(t:integer):integer;
begin
chuso := 0;
while t<>0 do
begin
chuso := chuso+t mod 10;
t := (t- t mod 10) div 10;
end;
end;
begin
repeat
write('Nhap n:');readln(n);
if (n>=10000) or (n<=0) then writeln('Nhap lai n');
until (n>0) and (n<10000);
if n<=898 then write('0');
if n>898 then
begin
for i := 899 to n do if (i mod 3 =2) and (chuso(i)=26) then inc(d);
writeln(d);
for i := 899 to n do if (i mod 3 =2) and (chuso(i)=26) then write(i:5);
end;
readln
end.