#include <bits/stdc++.h>
using namespace std;
long long n, ans;
void solve() {
  queue<long long> q;
  q.push(n);
  map<long long, bool> vis;
  while (!q.empty()) {
    long long tt = q.front();
    q.pop();
    vis[tt] = true;
    ans++;
    tt++;
    while (tt % 10 == 0) tt /= 10;
    if (!vis[tt]) q.push(tt);
  }
}
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cin.tie(0), cout.tie(0),
      cout.precision(15);
  cin >> n;
  solve();
  cout << ans;
  return 0;
}
