# AGC 025 A - Digits Sum

N = int(eval(input()))



def sum_of(num): 

    list_b = []

    k = 0

    while num > 0:

        list_b.append(num%10)

        num //= 10

    for i in range(len(list_b)):

        k += list_b[i]

    return k 



list_a =[]

if N <= 10:

    print((str(N)))

if N > 10:

    for i in range(2,N-1):

        A = i

        B = N - i

        list_a.append(sum_of(A) + sum_of(B))

    print((min(list_a)))
# AGC 025 A - Digits Sum

N = int(eval(input()))



def sum_of(num): 

    list_b = []

    k = 0

    while num > 0:

        list_b.append(num%10)

        num //= 10

    for i in range(len(list_b)):

        k += list_b[i]

    return k 



list_a =[]

if N <= 10:

    print((str(N)))

if N > 10:

    for i in range(2,(N-1)//2+1):

        A = i

        B = N - i

        list_a.append(sum_of(A) + sum_of(B))

    print((min(list_a)))
# AGC 025 A - Digits Sum
N = int(eval(input()))


def sum_of(num):
    list_b = []
    k = 0
    while num > 0:
        list_b.append(num % 10)
        num //= 10
    for i in range(len(list_b)):
        k += list_b[i]
    return k


list_a = []
if N <= 10:
    print((str(N)))
if N > 10:
    for i in range(2, N - 1):
        A = i
        B = N - i
        list_a.append(sum_of(A) + sum_of(B))
    print((min(list_a)))

# AGC 025 A - Digits Sum
N = int(eval(input()))


def sum_of(num):
    list_b = []
    k = 0
    while num > 0:
        list_b.append(num % 10)
        num //= 10
    for i in range(len(list_b)):
        k += list_b[i]
    return k


list_a = []
if N <= 10:
    print((str(N)))
if N > 10:
    for i in range(2, (N - 1) // 2 + 1):
        A = i
        B = N - i
        list_a.append(sum_of(A) + sum_of(B))
    print((min(list_a)))

-    for i in range(2, N - 1): +    for i in range(2, (N - 1) // 2 + 1):