#include <bits/stdc++.h>
using namespace std;
long long n;
map<pair<long long, long long>, pair<long long, long long> > mp;
pair<long long, long long> count(long long x, long long y) {
  if (mp.find(make_pair(x, y)) != mp.end()) return mp[make_pair(x, y)];
  long long temp = 1;
  while (x / 10 >= temp) temp *= 10;
  if (temp == 1) return mp[make_pair(x, y)] = make_pair(1, max(0ll, y - x));
  pair<long long, long long> a = count(x % temp, max(y, x / temp));
  pair<long long, long long> b = count(x / temp * temp - a.second, y);
  return mp[make_pair(x, y)] = make_pair(a.first + b.first, b.second);
}
int main() {
  cin >> n;
  if (n == 0) {
    cout << 0 << endl;
    return 0;
  }
  cout << count(n, 0).first << endl;
  return 0;
}
