def DigitsSum(n):

    sum = 0

    while (n != 0):

        sum += (n % 10)

        n = int(n / 10)

    return sum



N = int(eval(input()))



min_sum = 10**5

for i in range(1, N):

    sum = DigitsSum(i) + DigitsSum(N-i)

    if (sum < min_sum):

        min_sum = sum



print(min_sum)

def Digitsum(n):

    sum = 0

    while(n > 0):

        sum += (n % 10)

        n = int(n / 10)

    return sum



N = int(eval(input()))

n = N

ans = 0

while(True):

    if (n % 10 >= 2):

        #10のべき乗ではない

        ans = Digitsum(N)

        break

    elif (n % 10 == 1 and n >= 10):

        #10のべき乗ではない

        ans = Digitsum(N)

        break

    n = int(n / 10)

    if (n == 1):

        ans = 10

        break



print(ans)

def DigitsSum(n):
    sum = 0
    while n != 0:
        sum += n % 10
        n = int(n / 10)
    return sum


N = int(eval(input()))
min_sum = 10**5
for i in range(1, N):
    sum = DigitsSum(i) + DigitsSum(N - i)
    if sum < min_sum:
        min_sum = sum
print(min_sum)

def Digitsum(n):
    sum = 0
    while n > 0:
        sum += n % 10
        n = int(n / 10)
    return sum


N = int(eval(input()))
n = N
ans = 0
while True:
    if n % 10 >= 2:
        # 10のべき乗ではない
        ans = Digitsum(N)
        break
    elif n % 10 == 1 and n >= 10:
        # 10のべき乗ではない
        ans = Digitsum(N)
        break
    n = int(n / 10)
    if n == 1:
        ans = 10
        break
print(ans)

-def DigitsSum(n): +def Digitsum(n): -    while n != 0: +    while n > 0: -min_sum = 10**5 -for i in range(1, N): -    sum = DigitsSum(i) + DigitsSum(N - i) -    if sum < min_sum: -        min_sum = sum -print(min_sum) +n = N +ans = 0 +while True: +    if n % 10 >= 2: +        # 10のべき乗ではない +        ans = Digitsum(N) +        break +    elif n % 10 == 1 and n >= 10: +        # 10のべき乗ではない +        ans = Digitsum(N) +        break +    n = int(n / 10) +    if n == 1: +        ans = 10 +        break +print(ans)