n = int(eval(input()))

ans = []

for i in range(1,n):

    j = n-i

    si = 0

    sj = 0

    for s in str(i):

        si += int(s)

    for t in str(j):

        sj += int(t)

    ans.append(si+sj)



print((min(ans)))

n = eval(input())

if int(n)%10 == 0:

  print((10))

else:

  res = 0

  for i in range(len(n)):

    res += int(n[i])

  print(res)
n = int(eval(input()))
ans = []
for i in range(1, n):
    j = n - i
    si = 0
    sj = 0
    for s in str(i):
        si += int(s)
    for t in str(j):
        sj += int(t)
    ans.append(si + sj)
print((min(ans)))

n = eval(input())
if int(n) % 10 == 0:
    print((10))
else:
    res = 0
    for i in range(len(n)):
        res += int(n[i])
    print(res)

-n = int(eval(input())) -ans = [] -for i in range(1, n): -    j = n - i -    si = 0 -    sj = 0 -    for s in str(i): -        si += int(s) -    for t in str(j): -        sj += int(t) -    ans.append(si + sj) -print((min(ans))) +n = eval(input()) +if int(n) % 10 == 0: +    print((10)) +else: +    res = 0 +    for i in range(len(n)): +        res += int(n[i]) +    print(res)