#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const int N = 1e6 + 5;
long long pwr(long long x, long long y);
int n, t, m;
map<int, bool> r;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n;
  long long ans = 0;
  while (r[n] == 0) {
    r[n] = 1;
    ans++;
    n += 1;
    while (n % 10 == 0) {
      n /= 10;
    }
  }
  cout << ans << endl;
  return 0;
}
long long pwr(long long x, long long y) {
  long long ans = 1;
  x = x % mod;
  while (y > 0) {
    if (y & 1) ans = (x * (ans % mod)) % mod;
    x = (x * x) % mod;
    y = y / 2;
  }
  return ans % mod;
}
