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