#include <bits/stdc++.h>
const int MAX = (int)(2e5) + 7;
const int MOD = (int)(1e9) + 7;
const int INF_I = (int)(1e9) + 7;
const long long INF_LL = (long long)(1e18) + 7;
using namespace std;
long long n;
template <typename T>
void info(T& a) {
  for (auto& el : a) cout << el << ' ';
  cout << '\n';
}
template <typename T>
bool chkmax(T& a, T b) {
  if (b > a) {
    a = b;
    return true;
  }
  return false;
}
template <typename T>
bool chkmin(T& a, T b) {
  if (b < a) {
    a = b;
    return true;
  }
  return false;
}
void boot() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
}
void test() {}
long long f(long long x) {
  x += 1LL;
  while (x % 10 == 0) x /= 10;
  return x;
}
void solve() {
  test();
  set<long long> s;
  do {
    s.insert(n);
    n = f(n);
  } while (!s.count(n));
  cout << (int)((s).size()) << '\n';
}
signed main() {
  boot();
  while (cin >> n) solve();
}
