n=int(eval(input()));print((min([sum(list(map(int,str(i)))+list(map(int,str(n-i))))for i in range(1, n)])))
a=sum(int(i)for i in eval(input()));print((a if a!=1else 10))
n = int(eval(input()))
print(
    (
        min(
            [
                sum(list(map(int, str(i))) + list(map(int, str(n - i))))
                for i in range(1, n)
            ]
        )
    )
)

a = sum(int(i) for i in eval(input()))
print((a if a != 1 else 10))

-n = int(eval(input())) -print( -    ( -        min( -            [ -                sum(list(map(int, str(i))) + list(map(int, str(n - i)))) -                for i in range(1, n) -            ] -        ) -    ) -) +a = sum(int(i) for i in eval(input())) +print((a if a != 1 else 10))