#include <bits/stdc++.h>
using namespace std;
int main() {
  int t = 1;
  while (t--) {
    long long int c = 0, rem = 0, sum = 0;
    string s;
    cin >> s;
    while (s.size() > 1) {
      c++;
      for (long long i = 0; i < s.size(); i++) {
        sum += (s[i]) - '0';
      }
      stringstream ss;
      ss << sum;
      s = ss.str();
      sum = 0;
    }
    cout << c << "\n";
  }
  return 0;
}
