#include <bits/stdc++.h>
using namespace std;
int main() {
  string n;
  cin >> n;
  int sum = 0;
  int count = 1;
  if (n.length() == 1) {
    cout << "0\n";
    return 0;
  }
  for (int i = 0; i < n.length(); i++) {
    sum += n[i] - 48;
  }
  int sumofdigits = sum;
  while (sumofdigits / 10 != 0) {
    sum = sumofdigits;
    count++;
    sumofdigits = 0;
    while (sum) {
      int rem;
      rem = sum % 10;
      sum = sum / 10;
      sumofdigits += rem;
    }
  }
  cout << count << "\n";
  return 0;
}
