N = int(input())


def f(x):
    ret = 0
    while x:
        x, r = divmod(x, 10)
        ret += r
    return ret


ret = 10 ** 9
for a in range(1, N):
    b = N - a
    ret = min(ret, f(a) + f(b))
print(ret)

17ee3d805c689c07a45dcda31a3feb102c95034d
<mask token>

<mask token>


def f(x):
    ret = 0
    while x:
        x, r = divmod(x, 10)
        ret += r
    return ret


<mask token>

<mask token>


def f(x):
    ret = 0
    while x:
        x, r = divmod(x, 10)
        ret += r
    return ret


<mask token>
for a in range(1, N):
    b = N - a
    ret = min(ret, f(a) + f(b))
print(ret)

N = int(input())


def f(x):
    ret = 0
    while x:
        x, r = divmod(x, 10)
        ret += r
    return ret


ret = 10 ** 9
for a in range(1, N):
    b = N - a
    ret = min(ret, f(a) + f(b))
print(ret)
