#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void read(T &x) {
  x = 0;
  char c = getchar();
  bool f = 0;
  for (; !isdigit(c); c = getchar()) f ^= c == '-';
  for (; isdigit(c); c = getchar()) x = x * 10 + (c ^ 48);
  x = f ? -x : x;
}
template <class T>
inline void write(T x) {
  if (x < 0) {
    putchar('-');
    x = -x;
  }
  T y = 1;
  int len = 1;
  for (; y <= x / 10; y *= 10) ++len;
  for (; len; --len, x %= y, y /= 10) putchar(x / y + 48);
}
int n, ans;
map<int, bool> m;
int main() {
  read(n);
  for (; !m[n];) {
    m[n] = 1;
    ++ans;
    ++n;
    for (; n % 10 == 0; n /= 10)
      ;
  }
  write(ans);
  putchar('\n');
  return 0;
}
