#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
void solve() {
  long long n;
  cin >> n;
  set<long long> s;
  s.insert(n);
  n = n + 1;
  while (1) {
    while (n % 10 == 0) {
      n = n / 10;
    }
    if (s.find(n) != s.end()) {
      break;
    } else
      s.insert(n);
    n = n + 1;
  }
  cout << s.size() << "\n";
  ;
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0);
  solve();
}
