#include <bits/stdc++.h>   using namespace std;   bool IsPrime(int n) {     if (n == 1) return false;     for (int d = 2; d * d <= n; d++) {       if (n % d == 0) return false;     }     return true;   }   int main() {     int n;     cin >> n;     int count = 0;     while (n > 0) {       int j = 0;       int k = n;       int amx = INT_MIN;       while (k > 0) {         j = k % 10;         k = k / 10;         amx = max(amx, j);       }       n -= amx;       count++;     }     cout << count << endl;     return 0;   }   