n = int(eval(input()))

def digitsum(x):

    array = list(map(int, list(str(x))))

    return sum(array)



dsum = [digitsum(a)+digitsum(n-a) for a in range(1,int(n/2)+1)]

print((min(dsum)))
# n = int(input())

# def digitsum(x):

#     array = list(map(int, list(str(x))))

#     return sum(array)



# dsum = [digitsum(a)+digitsum(n-a) for a in range(1,int(n/2)+1)]

# print(min(dsum))

NL = list(map(int, list(eval(input()))))

 

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

    print((10))

else:

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


def digitsum(x):
    array = list(map(int, list(str(x))))
    return sum(array)


dsum = [digitsum(a) + digitsum(n - a) for a in range(1, int(n / 2) + 1)]
print((min(dsum)))

# n = int(input())
# def digitsum(x):
#     array = list(map(int, list(str(x))))
#     return sum(array)
# dsum = [digitsum(a)+digitsum(n-a) for a in range(1,int(n/2)+1)]
# print(min(dsum))
NL = list(map(int, list(eval(input()))))
if NL[0] == 1 and sum(NL) == 1:
    print((10))
else:
    print((sum(NL)))

-n = int(eval(input())) - - -def digitsum(x): -    array = list(map(int, list(str(x)))) -    return sum(array) - - -dsum = [digitsum(a) + digitsum(n - a) for a in range(1, int(n / 2) + 1)] -print((min(dsum))) +# n = int(input()) +# def digitsum(x): +#     array = list(map(int, list(str(x)))) +#     return sum(array) +# dsum = [digitsum(a)+digitsum(n-a) for a in range(1,int(n/2)+1)] +# print(min(dsum)) +NL = list(map(int, list(eval(input())))) +if NL[0] == 1 and sum(NL) == 1: +    print((10)) +else: +    print((sum(NL)))