program a1;
var
i,n,s:integer;
begin
assign(input,'input.txt');
assign(output,'output.txt');
reset(input);
rewrite(output);
readln(n);
if n
else begin
s := 0;
while (n > 0) do begin
s := s + n mod 10;
n := n div 10;
end;
writeln (s);
end;
close(input);
close(output);
end.