#include <bits/stdc++.h>
using namespace std;
int f(int x) {
  x++;
  while (x % 10 == 0) x /= 10;
  return x;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cout.precision(15);
  cout.setf(ios::fixed);
  cerr.precision(10);
  cerr.setf(ios::fixed);
  int n;
  while (cin >> n) {
    set<int> was;
    was.insert(n);
    while (true) {
      n = f(n);
      if (was.count(n)) break;
      was.insert(n);
    }
    cout << ((int)((was).size())) << endl;
  }
}
