#include <stdio.h>

int main() {
    int n,re;
    scanf("%d",&n);
    while(n)
    {
        re+=(n%10);
        n/=10;
    }
    printf("%d",re-1);
    return 0;
}