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