#include <bits/stdc++.h>
using namespace std;
long long f(long long n) {
  n += 1;
  while (n % 10 == 0) {
    n /= 10;
  }
  return n;
}
int main() {
  long long int n;
  cin >> n;
  set<long long> a;
  while (a.count(n) == 0) {
    a.insert(n);
    n = f(n);
  }
  cout << a.size() << endl;
  return 0;
}
