#include <bits/stdc++.h>
using namespace std;
set<int> A;
int main() {
  int n;
  while (scanf("%d", &n) != EOF) {
    while (A.find(n) == A.end()) {
      A.insert(n);
      n++;
      while (n % 10 == 0) {
        n /= 10;
      }
    }
    printf("%d\n", A.size());
    A.clear();
  }
  return 0;
}
