#include <bits/stdc++.h>
using namespace std;
void setup() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
}
set<int> a;
int main() {
  setup();
  int n, i;
  cin >> n;
  for (i = 0;; ++i) {
    a.insert(n);
    n++;
    while (n % 10 == 0) n /= 10;
    if (a.find(n) != a.end()) goto m;
  }
m:
  cout << a.size();
  return 0;
}
