def wa(t):

    sum=0

    while t>0:

       sum+=t%10

       t//=10

    return sum



n=int(eval(input()))

ans=[]

for i in range(1,n):

    ans.append(wa(i)+wa(n-i)) 

    if wa(i)+wa(n-i)==1:

        print(i)

print((min(ans)))
def wa(t):

    sum=0

    while t>0:

       sum+=t%10

       t//=10

    return sum



n=int(eval(input()))

ans=[]

for i in range(1,n):

    ans.append(wa(i)+wa(n-i)) 

print((min(ans)))
def wa(t):
    sum = 0
    while t > 0:
        sum += t % 10
        t //= 10
    return sum


n = int(eval(input()))
ans = []
for i in range(1, n):
    ans.append(wa(i) + wa(n - i))
    if wa(i) + wa(n - i) == 1:
        print(i)
print((min(ans)))

def wa(t):
    sum = 0
    while t > 0:
        sum += t % 10
        t //= 10
    return sum


n = int(eval(input()))
ans = []
for i in range(1, n):
    ans.append(wa(i) + wa(n - i))
print((min(ans)))

-    if wa(i) + wa(n - i) == 1: -        print(i)