# AGC025A - Digits Sum

def main():

    n = int(eval(input()))

    ans = float("inf")

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

        j = n - i

        ds = sum(map(int, str(i))) + sum(map(int, str(j)))  # digits sum

        ans = min(ans, ds)

    print(ans)





if __name__ == "__main__":

    main()
# AGC025A - Digits Sum

# Better ver.

def main():

    n = int(eval(input()))

    ans = sum(map(int, str(n)))  # ds: digit sum

    print((ans if ans != 1 else 10))





if __name__ == "__main__":

    main()
# AGC025A - Digits Sum
def main():
    n = int(eval(input()))
    ans = float("inf")
    for i in range(1, n // 2 + 1):
        j = n - i
        ds = sum(map(int, str(i))) + sum(map(int, str(j)))  # digits sum
        ans = min(ans, ds)
    print(ans)


if __name__ == "__main__":
    main()

# AGC025A - Digits Sum
# Better ver.
def main():
    n = int(eval(input()))
    ans = sum(map(int, str(n)))  # ds: digit sum
    print((ans if ans != 1 else 10))


if __name__ == "__main__":
    main()

+# Better ver. -    ans = float("inf") -    for i in range(1, n // 2 + 1): -        j = n - i -        ds = sum(map(int, str(i))) + sum(map(int, str(j)))  # digits sum -        ans = min(ans, ds) -    print(ans) +    ans = sum(map(int, str(n)))  # ds: digit sum +    print((ans if ans != 1 else 10))