#include <bits/stdc++.h>
using namespace std;
void CyBerForCe() {
  long long n;
  cin >> n;
  set<long long> s;
  long long m = n;
  m++;
  while (s.find(m) == s.end()) {
    while (m % 10 == 0) m /= 10;
    s.insert(m);
    m++;
  }
  if (s.find(n) == s.end()) s.insert(n);
  cout << s.size() << "\n";
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  CyBerForCe();
  return 0;
}
