#include <bits/stdc++.h>
using namespace std;
const long long N = 3e5 + 5;
const long long INF = 1e18;
const long long mod = 1e9 + 7;
void solve() {
  long long n, m, k;
  string s;
  cin >> n;
  map<int, int> F;
  while (true) {
    F[n] = 1;
    n = n + 1;
    while (n % 10 == 0) n /= 10;
    if (F.find(n) != F.end()) break;
  }
  cout << F.size();
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t;
  t = 1;
  while (t--) solve();
  return 0;
}
