#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  long long sum = 0;
  int c = 1;
  for (int i = 0; i < s.size(); i++) {
    sum += s[i] - 48;
  }
  if (s.size() == 1)
    cout << "0";
  else {
    while (sum > 9) {
      int res = 0;
      c++;
      while (sum > 0) {
        res += sum % 10;
        sum = sum / 10;
      }
      sum = res;
    }
    cout << c;
  }
  return 0;
}
