n=int(input())

ret=[]

for y in range(n/2):

	a=y+1

	b=n-a

	r1 = 0

	r2 = 0

	for i in str(a):

		r1 += int(i)

	for x in str(b):

		r2 += int(x)

	r=r1+r2

	ret.append(r)

print(min(ret))
a = int(eval(input()))

lim = a // 2

soma_lista = []

menor = 100000

for i in range(a - 1, lim, -1):

    b = str(a - abs(i)) + str(abs(i))

    soma = 0

    for digit in b:

        soma += int(digit)

    if soma < menor:

        menor = soma

if a == 2:

    print(a)

else:

    print(menor)

n = int(input())
ret = []
for y in range(n / 2):
    a = y + 1
    b = n - a
    r1 = 0
    r2 = 0
    for i in str(a):
        r1 += int(i)
    for x in str(b):
        r2 += int(x)
    r = r1 + r2
    ret.append(r)
print(min(ret))

a = int(eval(input()))
lim = a // 2
soma_lista = []
menor = 100000
for i in range(a - 1, lim, -1):
    b = str(a - abs(i)) + str(abs(i))
    soma = 0
    for digit in b:
        soma += int(digit)
    if soma < menor:
        menor = soma
if a == 2:
    print(a)
else:
    print(menor)

-n = int(input()) -ret = [] -for y in range(n / 2): -    a = y + 1 -    b = n - a -    r1 = 0 -    r2 = 0 -    for i in str(a): -        r1 += int(i) -    for x in str(b): -        r2 += int(x) -    r = r1 + r2 -    ret.append(r) -print(min(ret)) +a = int(eval(input())) +lim = a // 2 +soma_lista = [] +menor = 100000 +for i in range(a - 1, lim, -1): +    b = str(a - abs(i)) + str(abs(i)) +    soma = 0 +    for digit in b: +        soma += int(digit) +    if soma < menor: +        menor = soma +if a == 2: +    print(a) +else: +    print(menor)