#include <iostream>
using namespace std;
int cifre(int n)
{
int p = 1;
while(n > 0)
{
p *= 10;
n /= 10;
}
return p;
}
int main()
{
int n;
cin >> n;
int k = cifre(n)/10, suma = 0;
while(k >= 10)
{
suma += n % k;
k /= 10;
}
cout << suma;
return 0;
}