#include <bits/stdc++.h>
using namespace std;
long long n, q;
map<long long, bool> us;
int main() {
  cin >> n;
  while (1) {
    if (us[n]) break;
    us[n] = 1;
    q++;
    n++;
    while (n % 10 == 0) {
      n /= 10;
    }
  }
  cout << q;
  return 0;
}
