#include <bits/stdc++.h>
using namespace std;
int in() {
  int n;
  scanf("%d", &n);
  return n;
}
long long Lin() {
  long long n;
  scanf("%lld", &n);
  return n;
}
double Din() {
  double n;
  scanf("%lf", &n);
  return n;
}
const long long inf = (long long)1e17;
const long long mod = (long long)1e9 + 7;
const int N = 5e5 + 5;
map<int, bool> vis;
int cal(int n) {
  n++;
  while (n % 10 == 0) n /= 10;
  return n;
}
int solve() {
  int n = in();
  int ans = 0;
  while (1) {
    if (vis[n]) break;
    ans++, vis[n] = true;
    n = cal(n);
  }
  cout << ans << '\n';
  return 0;
}
int main() {
  int test = 1, tc = 0;
  while (test--) {
    solve();
  }
  return 0;
}
