#include <bits/stdc++.h>
using namespace std;
void pv(std::vector<int> v) {
  for (int i = 0; i < v.size(); ++i) {
    cout << v[i] << " ";
  }
  cout << "" << endl;
}
void pa(int a[], int n, int p) {
  for (int i = p; i < n + p; ++i) {
    cout << a[i] << " ";
  }
  cout << "" << endl;
}
const double pi = 3.141592653589793238;
const long long int inf = (long long int)10e16;
int main() {
  ios ::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, ans = 0;
  cin >> n;
  set<int, greater<int> > a1;
  ans++;
  a1.insert(n);
  while (n != 1) {
    n++;
    while (n % 10 == 0) {
      n = n / 10;
    }
    if (n != 1) {
      a1.insert(n);
      ans++;
    }
  }
  for (int i = 1; i <= 9; i += 1)
    if (!a1.count(i)) {
      a1.insert(i);
      ans++;
    }
  cout << ans << endl;
  cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
}
