#include <bits/stdc++.h>
using namespace std;
int main() {
  map<long long, long long> m;
  long long n;
  cin >> n;
  while (m.find(n) == m.end()) {
    m[n]++;
    n++;
    while (n % 10 == 0) n /= 10;
  }
  int cnt = 0;
  for (auto i : m) {
    cnt++;
  }
  cout << cnt;
}
