#include <bits/stdc++.h>
using namespace std;
int main() {
  string a;
  unsigned long long int counter = 0, f = 0;
  int q = 0;
  cin >> a;
  if (a.length() == 1) {
    cout << "0";
    return 0;
  }
  for (int i = 0; i < a.length(); i++) counter += a[i] - '0';
  q++;
  while (1) {
    if (counter / 10 == 0) {
      cout << q;
      return 0;
    }
    while (counter != 0) {
      f += counter % 10;
      counter /= 10;
    }
    counter = f;
    f = 0;
    q++;
  }
}
