N=int(eval(input()))



import numpy as np



a=np.arange(N)

a=np.delete(a,0)



b=N-a



num_arr=[]



for i in range(len(a)):

	factor_a=[int(x) for x in list(str(a[i]))]

	factor_b=[int(x) for x in list(str(b[i]))]

	num_arr.append(sum(factor_a)+sum(factor_b))



print((min(num_arr)))

N=int(eval(input()))



def SumOfDigits(n):

	ans=0

	while(True):

		if n==0:

			break

		ans+=n%10

		n=n//10

	return ans



ans=N

for a in range(N):

	if a!=0:

		b=N-a

		if ans>SumOfDigits(a)+SumOfDigits(b):

			ans=SumOfDigits(a)+SumOfDigits(b)

print(ans)

N = int(eval(input()))
import numpy as np

a = np.arange(N)
a = np.delete(a, 0)
b = N - a
num_arr = []
for i in range(len(a)):
    factor_a = [int(x) for x in list(str(a[i]))]
    factor_b = [int(x) for x in list(str(b[i]))]
    num_arr.append(sum(factor_a) + sum(factor_b))
print((min(num_arr)))

N = int(eval(input()))


def SumOfDigits(n):
    ans = 0
    while True:
        if n == 0:
            break
        ans += n % 10
        n = n // 10
    return ans


ans = N
for a in range(N):
    if a != 0:
        b = N - a
        if ans > SumOfDigits(a) + SumOfDigits(b):
            ans = SumOfDigits(a) + SumOfDigits(b)
print(ans)

-import numpy as np -a = np.arange(N) -a = np.delete(a, 0) -b = N - a -num_arr = [] -for i in range(len(a)): -    factor_a = [int(x) for x in list(str(a[i]))] -    factor_b = [int(x) for x in list(str(b[i]))] -    num_arr.append(sum(factor_a) + sum(factor_b)) -print((min(num_arr))) + +def SumOfDigits(n): +    ans = 0 +    while True: +        if n == 0: +            break +        ans += n % 10 +        n = n // 10 +    return ans + + +ans = N +for a in range(N): +    if a != 0: +        b = N - a +        if ans > SumOfDigits(a) + SumOfDigits(b): +            ans = SumOfDigits(a) + SumOfDigits(b) +print(ans)