#include <bits/stdc++.h>
using namespace std;
long l[100009];
int main() {
  long n, m = 0, a = 0;
  cin >> n;
  while (1) {
    if (!binary_search(l, l + a, n)) {
      m++;
      l[a] = n;
      a++;
      sort(l, l + a);
    } else
      break;
    n++;
    while (1) {
      if (n % 10 == 0)
        n /= 10;
      else
        break;
    }
  }
  cout << m;
}
