#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  long long n;
  cin >> n;
  vector<int> a;
  a.push_back(n);
  while (1) {
    for (int i = 0; i < a.size() - 1; ++i) {
      if (n == a[i]) {
        cout << a.size() - 1;
        return 0;
      }
    }
    n++;
    while (n % 10 == 0) {
      n /= 10;
    }
    a.push_back(n);
  }
}
