#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base ::sync_with_stdio(false);
  cin.tie(NULL);
  long long int n;
  cin >> n;
  set<long long int> s;
  while (s.find(n) == s.end()) {
    s.insert(n);
    n += 1;
    while (n % 10 == 0) n /= 10;
  }
  cout << s.size();
}
