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