#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  if (s.size() == 1) {
    cout << 0 << "\n";
    return 0;
  }
  int cnt = 0, summation = 10;
  while (summation > 9) {
    summation = 0;
    for (int i = 0; i < s.size(); ++i) {
      summation += s[i] - '0';
    }
    s = to_string(summation);
    ++cnt;
  }
  cout << cnt << "\n";
  return 0;
}
