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