#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, j = 0;
  long long int sum = 0, len = 0;
  int a[11];
  cin >> n;
  while (n != 0) {
    a[j] = n % 10;
    n /= 10;
    j++;
  }
  len = j;
  for (int i = 0; i < len - 1; i++) {
    sum += (9 - a[i]);
  }
  sum += 9;
  if (len > 1)
    cout << sum + 1;
  else
    cout << sum;
  return 0;
}
