def digit_sum(x):

    a = list(range(1, x))

    min_n = x

    for i in a:

        b = x - i

        p = sum(list(map(int, list(str(i)))))

        q = sum(list(map(int, list(str(b)))))

        if min_n > (p+q):

            min_n = p+q

        if a == b:

            break

    return min_n

N = int(eval(input()))

print((digit_sum(N)))
N = int(eval(input()))

p = N

sums = 0

if N == 10 or N == 100 or N == 1000 or N == 10000 or N == 100000:

    print((10))

else:

    while p >= 1:

        sums += p%10

        p //= 10

    print(sums)
def digit_sum(x):
    a = list(range(1, x))
    min_n = x
    for i in a:
        b = x - i
        p = sum(list(map(int, list(str(i)))))
        q = sum(list(map(int, list(str(b)))))
        if min_n > (p + q):
            min_n = p + q
        if a == b:
            break
    return min_n


N = int(eval(input()))
print((digit_sum(N)))

N = int(eval(input()))
p = N
sums = 0
if N == 10 or N == 100 or N == 1000 or N == 10000 or N == 100000:
    print((10))
else:
    while p >= 1:
        sums += p % 10
        p //= 10
    print(sums)

-def digit_sum(x): -    a = list(range(1, x)) -    min_n = x -    for i in a: -        b = x - i -        p = sum(list(map(int, list(str(i))))) -        q = sum(list(map(int, list(str(b))))) -        if min_n > (p + q): -            min_n = p + q -        if a == b: -            break -    return min_n - - -print((digit_sum(N))) +p = N +sums = 0 +if N == 10 or N == 100 or N == 1000 or N == 10000 or N == 100000: +    print((10)) +else: +    while p >= 1: +        sums += p % 10 +        p //= 10 +    print(sums)