#include <bits/stdc++.h>
using namespace std;
void f(int &n) {
  n++;
  while (n % 10 == 0) n /= 10;
}
set<int> gasite;
int main() {
  int n, nr = 0, unu = 0;
  cin >> n;
  while (gasite.find(n) == gasite.end()) {
    gasite.insert(n);
    f(n);
    ++nr;
  }
  cout << nr;
  return 0;
}
