#include <bits/stdc++.h>
using namespace std;
map<long long, int> mp;
int main() {
  long long tmp;
  cin >> tmp;
  int cnt = 0;
  mp[tmp]++;
  while (true) {
    tmp++;
    while (tmp % 10 == 0) {
      tmp /= 10;
    }
    mp[tmp]++;
    if (mp[tmp] == 2) break;
  }
  cout << mp.size() << endl;
}
