#include <bits/stdc++.h>
using namespace std;
static const int maxn = 100010;
static const int INF = 0x3f3f3f3f;
static const int mod = (int)1e9 + 7;
static const double eps = 1e-6;
static const double pi = acos(-1);
void redirect() {}
unordered_set<int> s;
int main() {
  redirect();
  int n;
  scanf("%d", &n);
  while (!s.count(n)) {
    s.insert(n);
    n += 1;
    if (n == 0) break;
    while (n % 10 == 0) n /= 10;
  }
  printf("%d\n", s.size());
  return 0;
}
