#include <bits/stdc++.h>
using namespace std;
char buf[100005];
void Solve(int n) {
  int sum = 0, time = 1;
  do {
    ++time;
    while (n) {
      sum += n % 10;
      n /= 10;
    }
    n = sum;
    sum = 0;
  } while (n >= 10);
  cout << '\n' << time;
}
int main() {
  int i, n;
  cin >> buf;
  n = strlen(buf);
  if (n == 1)
    cout << 0 << '\n';
  else {
    n = 0;
    for (i = 0; buf[i]; ++i) n += buf[i] - '0';
    if (n < 10)
      cout << 1 << '\n';
    else {
      Solve(n);
    }
  }
  return 0;
}
