#include <bits/stdc++.h>
using namespace std;
map<int, int> mp;
int f(int n) {
  n++;
  while (n % 10 == 0) {
    n = n / 10;
  }
  return n;
}
int main() {
  int n;
  cin >> n;
  int cnt = 0;
  while (true) {
    if (mp[n] > 0) {
      break;
    }
    mp[n]++;
    cnt++;
    n = f(n);
  }
  cout << cnt << endl;
}
