#include <bits/stdc++.h>
using namespace std;
long long fn(long long n) {
  long long temp = n + 1;
  while (temp) {
    if (temp % 10 == 0)
      temp /= 10;
    else
      return temp;
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int t = 1;
  while (t--) {
    long long n;
    cin >> n;
    set<long long> a;
    a.insert(n);
    while (true) {
      n = fn(n);
      if (a.count(n) == 1) {
        cout << a.size();
        return 0;
      } else {
        a.insert(n);
      }
    }
  }
}
