#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  set<int> s;
  while (1) {
    int k = s.size();
    s.insert(n);
    int m = s.size();
    if (k == m) break;
    n = n + 1;
    while (n % 10 == 0) {
      n = n / 10;
    }
  }
  cout << s.size() << endl;
  return 0;
}
