#include <bits/stdc++.h>
using namespace std;
int main() {
  string str;
  int s = INT_MAX, counter = 0;
  cin >> str;
  int temp = str.length();
  if (temp == 1) {
    cout << "0";
    return 0;
  }
  while (s > 9) {
    temp = str.length();
    s = 0;
    for (int i = 0; i < temp; i++) {
      s = s + (int)(str[i] - '0');
    }
    counter++;
    str = to_string(s);
  }
  cout << counter;
}
