#include <iostream>
#include<math.h>
using namespace std;
int main()
{
long n;
cin >> n;
int sum = 0;
while (n >= 10)
{
sum += n % 10;
if (n == 0)
n /= 10;
else
n = (n - n % 10) / 10;
}
sum += n;
cout << sum;
}
#include <iostream>
#include<math.h>
using namespace std;
int main()
{
long n;
cin >> n;
int sum = 0;
while (n >= 10)
{
sum += n % 10;
if (n == 0)
n /= 10;
else
n = (n - n % 10) / 10;
}
sum += n;
cout << sum;
}