#include <bits/stdc++.h>   using namespace std;   int main() {     long long n;     cin >> n;     int m = 0;     while (n > 9) {       n -= 9;       m += 9 + n % 10;       n /= 10;     }     cout << m + n << endl;     return 0;   }   