#include <bits/stdc++.h>
using namespace std;
int f(int o) {
  o += 1;
  while (o % 10 == 0) o /= 10;
  return o;
}
int main() {
  set<int> st;
  int n = 0;
  cin >> n;
  int max = -n;
  int r = n;
  while (true) {
    if (st.find(r) == st.end())
      st.insert(r);
    else
      break;
    if (r > max) max = r;
    r = f(r);
  }
  cout << st.size();
  return 0;
}
