#include <bits/stdc++.h>
using namespace std;
int dx[] = {-1, 0, 0, 1};
int dy[] = {0, 1, -1, 0};
int kx[] = {2, 2, -2, -2, 1, 1, -1, -1};
int ky[] = {1, -1, 1, -1, 2, -2, 2, -2};
vector<long long> v;
bool find(long long n) {
  int x = v.size();
  for (int i = 0; i < x; i++) {
    if (n == v[i]) {
      return true;
    }
  }
  return false;
}
int main() {
  long long n;
  scanf("%lld", &n);
  v.push_back(n);
  int x = 0;
  while (1) {
    n++;
    while (n % 10 == 0) {
      n /= 10;
    }
    x++;
    if (find(n)) {
      break;
    }
    v.push_back(n);
  }
  printf("%d", x);
  return 0;
}
