N = int(eval(input()))



def digitSum(X):



    ds = 0

    for x in str(X):

        ds += int(x)

    return ds



ans = N



for i in range(1, N):

    dgtSum = digitSum(i) + digitSum(N - i)

    if ans > dgtSum:

        ans = dgtSum



print(ans)

def sumDigit(x):

	total = 0

	while x > 0:

		total += x % 10

		x = x // 10



	return total



N = int(eval(input()))

ans = []



for a in range(1, N):

	sum_A = sumDigit(a)

	sum_B = sumDigit(N - a)

	ans.append(sum_A + sum_B)



print((min(ans)))
N = int(eval(input()))


def digitSum(X):
    ds = 0
    for x in str(X):
        ds += int(x)
    return ds


ans = N
for i in range(1, N):
    dgtSum = digitSum(i) + digitSum(N - i)
    if ans > dgtSum:
        ans = dgtSum
print(ans)

def sumDigit(x):
    total = 0
    while x > 0:
        total += x % 10
        x = x // 10
    return total


N = int(eval(input()))
ans = []
for a in range(1, N):
    sum_A = sumDigit(a)
    sum_B = sumDigit(N - a)
    ans.append(sum_A + sum_B)
print((min(ans)))

-N = int(eval(input())) +def sumDigit(x): +    total = 0 +    while x > 0: +        total += x % 10 +        x = x // 10 +    return total -def digitSum(X): -    ds = 0 -    for x in str(X): -        ds += int(x) -    return ds - - -ans = N -for i in range(1, N): -    dgtSum = digitSum(i) + digitSum(N - i) -    if ans > dgtSum: -        ans = dgtSum -print(ans) +N = int(eval(input())) +ans = [] +for a in range(1, N): +    sum_A = sumDigit(a) +    sum_B = sumDigit(N - a) +    ans.append(sum_A + sum_B) +print((min(ans)))