#include <bits/stdc++.h>
using namespace std;
set<int> s;
int main() {
  int x;
  cin >> x;
  s.insert(x);
  for (;;) {
    x++;
    while (x % 10 == 0) x /= 10;
    int sz = s.size();
    s.insert(x);
    if (sz == s.size()) {
      printf("%d", s.size());
      return 0;
    }
  }
}
