#include <bits/stdc++.h>
using namespace std;
int n, m;
set<int> s;
int main() {
  scanf("%d", &n);
  m = n;
  s.insert(n);
  while (n % 10 != 0) {
    n++;
    if (n % 10 == 0) {
      while (n % 10 == 0) n /= 10;
      s.insert(n);
      break;
    }
    s.insert(n);
  }
  if (n == 1) {
    n++;
    s.insert(n);
  }
  while (n != 1) {
    n++;
    while (n % 10 == 0) {
      n /= 10;
    }
    s.insert(n);
  }
  for (int i = 2; i <= 9; i++) s.insert(i);
  cout << s.size() << endl;
  return 0;
}
