def kakuwa(S):

    A = list(str(S))

    B = [int(x) for x in A]

    return sum(B)

    

N = int(eval(input()))

ans = 50

for i in range(1,N):

    ans = min(ans, kakuwa(i) + kakuwa(N-i))

print(ans)
def kakuwa(S):

    A = list(str(S))

    B = [int(x) for x in A]

    return sum(B)

    

N = int(eval(input()))

for i in range(1,5):

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

        ans = 10

        break

else:

    ans = kakuwa(N)

print(ans)
def kakuwa(S):
    A = list(str(S))
    B = [int(x) for x in A]
    return sum(B)


N = int(eval(input()))
ans = 50
for i in range(1, N):
    ans = min(ans, kakuwa(i) + kakuwa(N - i))
print(ans)

def kakuwa(S):
    A = list(str(S))
    B = [int(x) for x in A]
    return sum(B)


N = int(eval(input()))
for i in range(1, 5):
    if N % (10**i) == 0:
        ans = 10
        break
else:
    ans = kakuwa(N)
print(ans)

-ans = 50 -for i in range(1, N): -    ans = min(ans, kakuwa(i) + kakuwa(N - i)) +for i in range(1, 5): +    if N % (10**i) == 0: +        ans = 10 +        break +else: +    ans = kakuwa(N)