#include <bits/stdc++.h>
using namespace std;
int adder(int n);
int main() {
  long long int T;
  cin >> T;
  set<int> arr;
  long long int ck = 1, c = 0, p;
  while (1) {
    c = arr.size();
    arr.insert(T);
    if (arr.size() == c) break;
    T = adder(T);
  }
  cout << arr.size() << endl;
  return 0;
}
int adder(int n) {
  n++;
  while (n % 10 == 0) n /= 10;
  return n;
}
