#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  scanf("%lld", &n);
  map<long long, long long> vis;
  vis[n]++;
  while (1) {
    if (n % 10 == 9) {
      n += 1;
      while (n % 10 == 0) n /= 10;
      if (!vis[n]) {
        vis[n]++;
      } else
        break;
    } else {
      if (!vis[n + 1])
        n++, vis[n]++;
      else
        break;
    }
  }
  cout << vis.size();
}
