#include <bits/stdc++.h>
using namespace std;
const int N = 200;
int n, m, h, a[N][N], r[N], c[N];
map<int, int> Mp;
int f(int x) {
  x = x + 1;
  while (x % 10 == 0) {
    x = x / 10;
  }
  return x;
}
int main() {
  int ans = 0;
  cin >> n;
  while (!Mp[n]) {
    Mp[n] = 1;
    ans++;
    n = f(n);
  }
  return 0 * printf("%d\n", ans);
}
