n = int(eval(input()))

ans = 100000

for i in range(1, n):

    a, b = str(i), str(n-i)

    A, B = 0, 0

    for x in a:

        A += int(x)

    for y in b:

        B += int(y)

    ans = min(ans, A+B)

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

for i in range(1,6):

    if n%(10*i) == 0:

        print((10))

        exit()

print((sum(list(map(int, str(n))))))
n = int(eval(input()))
ans = 100000
for i in range(1, n):
    a, b = str(i), str(n - i)
    A, B = 0, 0
    for x in a:
        A += int(x)
    for y in b:
        B += int(y)
    ans = min(ans, A + B)
print(ans)

n = int(eval(input()))
for i in range(1, 6):
    if n % (10 * i) == 0:
        print((10))
        exit()
print((sum(list(map(int, str(n))))))

-ans = 100000 -for i in range(1, n): -    a, b = str(i), str(n - i) -    A, B = 0, 0 -    for x in a: -        A += int(x) -    for y in b: -        B += int(y) -    ans = min(ans, A + B) -print(ans) +for i in range(1, 6): +    if n % (10 * i) == 0: +        print((10)) +        exit() +print((sum(list(map(int, str(n))))))