#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  set<int> s;
  while (s.find(n) == s.end()) {
    s.insert(n);
    n++;
    while (n % 10 == 0) n /= 10;
  }
  cout << s.size() << '\n';
}
