#include <bits/stdc++.h>
using namespace std;
const int N = 100010;
long long t, mx, s, a[N], n, ans, m;
bool bol;
vector<int> v;
int main() {
  cin >> n;
  ans = 1;
  m = n;
  bol = true;
  v.push_back(n);
  while (true) {
    n++;
    while (n % 10 == 0) n /= 10;
    for (int i = 0; i < v.size(); i++)
      if (n == v[i]) {
        bol = false;
        break;
      }
    if (!bol) break;
    ans++;
    v.push_back(n);
  }
  cout << ans << endl;
  return 0;
}
