#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int t = 0;
  int sum = 0;
  if (s.length() == 1) {
    cout << 0;
  } else {
    while (1) {
      for (int i = 0; i < s.length(); i++) {
        sum += s[i] - '0';
      }
      t++;
      if (sum <= 9) break;
      s = to_string(sum);
      sum = 0;
    }
    cout << t;
  }
}
