#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n, i, j, a[1000005], b[1000005], p = 0, q = 0, m, temp = 0,
                                             flag = 0, ans, r = 0, s = 0;
  vector<long long> v;
  string str;
  cin >> n;
  map<long long, long long> mp;
  while (1) {
    if (mp[n] == 1) {
      break;
    }
    mp[n] = 1;
    p++;
    n++;
    while (n % 10 == 0) {
      n = n / 10;
    }
  }
  cout << p;
  return 0;
}
