#include <bits/stdc++.h>
int main() {
  int n;
  scanf("%d", &n);
  int counter = 0;
  while (1) {
    if (n >= 1 && n <= 9) {
      counter += 9;
      break;
    }
    n = n + 1;
    while (1) {
      if (n % 10 == 0) {
        n = n / 10;
      } else {
        break;
      }
    }
    counter++;
  }
  printf("%d\n", counter);
  return 0;
}
