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