N = int(eval(input()))

def sumof(N):

  sum = 0

  while(N>0):

    sum += N % 10

    N //= 10

  return sum



minsum = 9*10

for i in range(1,N//2+1):

  minsum = min(minsum,sumof(i) + sumof(N-i))

print(minsum)

NL = [int(x) for x in str(eval(input()))]

if NL[0] == 1 and sum(NL) == 1:

    print((10))

else:

    print((sum(NL)))
N = int(eval(input()))


def sumof(N):
    sum = 0
    while N > 0:
        sum += N % 10
        N //= 10
    return sum


minsum = 9 * 10
for i in range(1, N // 2 + 1):
    minsum = min(minsum, sumof(i) + sumof(N - i))
print(minsum)

NL = [int(x) for x in str(eval(input()))]
if NL[0] == 1 and sum(NL) == 1:
    print((10))
else:
    print((sum(NL)))

-N = int(eval(input())) - - -def sumof(N): -    sum = 0 -    while N > 0: -        sum += N % 10 -        N //= 10 -    return sum - - -minsum = 9 * 10 -for i in range(1, N // 2 + 1): -    minsum = min(minsum, sumof(i) + sumof(N - i)) -print(minsum) +NL = [int(x) for x in str(eval(input()))] +if NL[0] == 1 and sum(NL) == 1: +    print((10)) +else: +    print((sum(NL)))