#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  unordered_set<long long> s;
  for (int i = 1; i <= 9; i++) s.insert(i);
  s.insert(n);
  while (n > 9) {
    n++;
    while (n % 10 == 0) n /= 10;
    s.insert(n);
  }
  cout << s.size();
}
