#include <bits/stdc++.h>
using namespace std;
unordered_map<int, bool> ma;
int x, ans;
void work(int a) {
  if (ma[a] == 1)
    return;
  else {
    ans++;
    ma[a] = 1;
    a++;
    while (a % 10 == 0) a /= 10;
    work(a);
  }
}
int main() {
  scanf("%d", &x);
  work(x);
  printf("%d", ans);
  return 0;
}
