n=int(eval(input()))

res=100000

for i in range(1,n):

    j=n-i

    s=0

    for c in str(i):

        s+=int(c)

    for c in str(j):

        s+=int(c)

    res=min(res,s)

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

s=0

while n>0:

  s+=n%10

  n//=10

if s==1:

  print((10))

else:

  print(s)
n = int(eval(input()))
res = 100000
for i in range(1, n):
    j = n - i
    s = 0
    for c in str(i):
        s += int(c)
    for c in str(j):
        s += int(c)
    res = min(res, s)
print(res)

n = int(eval(input()))
s = 0
while n > 0:
    s += n % 10
    n //= 10
if s == 1:
    print((10))
else:
    print(s)

-res = 100000 -for i in range(1, n): -    j = n - i -    s = 0 -    for c in str(i): -        s += int(c) -    for c in str(j): -        s += int(c) -    res = min(res, s) -print(res) +s = 0 +while n > 0: +    s += n % 10 +    n //= 10 +if s == 1: +    print((10)) +else: +    print(s)