#include <bits/stdc++.h>
using namespace std;
int main() {
  char a[100000];
  cin >> a;
  int i = 0, j = 0, n = 0;
  if (a[1]) {
    do {
      for (; a[i];) {
        j += a[i] - 48;
        i++;
      }
      i = 0;
      for (; j > 0;) {
        a[i] = 48 + j % 10;
        j /= 10;
        i++;
      }
      a[i] = 0;
      n++;
      i = 0;
    } while (a[1]);
  } else
    n = 0;
  cout << n << endl;
  return 0;
}
