#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
int n;
int main() {
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  int ans = 9;
  cin >> n;
  while (n > 9) {
    ans++;
    n += 1;
    while (n % 10 == 0) {
      n /= 10;
    }
  }
  cout << ans << endl;
  return 0;
}
