#include <bits/stdc++.h>
const double EPS = 1e-9;
const int MOD = 1e9 + 7;
const int MAXN = 1e5 + 9;
const int dx[] = {1, -1, 0, 0, 0, 0};
const int dy[] = {0, 0, 1, -1, 0, 0};
const int dz[] = {0, 0, 0, 0, 1, -1};
using namespace std;
int func(int x) {
  x++;
  while (x % 10 == 0) x /= 10;
  return x;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  set<int> s;
  while (!s.count(n)) {
    s.insert(n);
    n = func(n);
  }
  cout << s.size() << '\n';
}
