#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long int n;
  cin >> n;
  string num = to_string(n);
  int cnt = num.size();
  int dp[cnt];
  long long int zero = 0;
  for (int i = 0; i < cnt; i++) {
    dp[i] = n % 10;
    n /= 10;
  }
  reverse(dp, dp + cnt);
  int i = cnt - 1;
  while (1) {
    i = cnt - 1;
    if (*max_element(dp, dp + cnt) == 0) break;
    int maxi = *max_element(dp, dp + cnt);
    if (dp[i] >= maxi) {
      dp[i] = dp[i] - maxi;
      zero++;
    } else if (dp[i] < maxi) {
      if (dp[i - 1] != 0) {
        dp[i - 1]--;
        dp[i] = (dp[i] + 10) - maxi;
        zero++;
      } else {
        int var = i - 1;
        while (var >= 0 && dp[var] == 0) {
          var--;
        }
        dp[var]--;
        var++;
        while (var < i) {
          dp[var] = 9;
          var++;
        }
        dp[i] = (dp[i] + 10) - maxi;
        zero++;
      }
    }
  }
  cout << zero << endl;
}
