ans=999999999

n = int(eval(input()))

for i in range(1,n//2+1):

    x=str(i)

    y=str(n-i)

    ans=min(ans, sum(map(int, x))+sum(map(int, y)))

    

print(ans)
n=int(eval(input()))

if n%10==0:

    print((10))

else:

    print((sum(map(int,list(str(n))))))
ans = 999999999
n = int(eval(input()))
for i in range(1, n // 2 + 1):
    x = str(i)
    y = str(n - i)
    ans = min(ans, sum(map(int, x)) + sum(map(int, y)))
print(ans)

n = int(eval(input()))
if n % 10 == 0:
    print((10))
else:
    print((sum(map(int, list(str(n))))))

-ans = 999999999 -for i in range(1, n // 2 + 1): -    x = str(i) -    y = str(n - i) -    ans = min(ans, sum(map(int, x)) + sum(map(int, y))) -print(ans) +if n % 10 == 0: +    print((10)) +else: +    print((sum(map(int, list(str(n))))))