#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, ans = 0;
  cin >> N;
  for (;;) {
    ans = ans + (N % 10);
    int s = N - (N % 10);
    N = s / 10;
    if (N == 0) break;
  }
  cout << ans << endl;
}
