function SumDigit(n: integer): integer;
begin
result := 0;
var s := n.ToString;
for var i := 1 to s.length do
result += s[i].ToDigit;
end;
begin
var n := ReadInteger();
var SumN := SumDigit(n);
var found := False;
for var i := 1 to n - 1 do
if SumDigit(i) = SumN then
begin
Print(i);
found := True
end;
if not found then Print('нет')
end.