#include <bits/stdc++.h>
using namespace std;
int main() {
  string Number;
  long long int sum = 0, var = 0;
  int a, Step = 0;
  cin >> Number;
  for (a = 0; a < Number.length(); a++) {
    sum += Number[a] - '0';
  }
  if (sum > 0 && a > 1) Step++;
  while (sum > 9) {
    Step++;
    while (sum > 0) {
      var += sum % 10;
      sum /= 10;
    }
    sum = var;
    var = 0;
  }
  cout << Step << endl;
  return 0;
}
