#include <bits/stdc++.h>
using namespace std;
char str[100005];
int main() {
  int n;
  while (scanf("%s", str) == 1) {
    n = 0;
    int s = 0, i = 0;
    while (str[i]) {
      n += (str[i] - '0');
      ++i;
    }
    if (i > 1) s = 1;
    while (n >= 10) {
      s++;
      int temp = n;
      n = 0;
      while (temp) {
        n += temp % 10;
        temp /= 10;
      }
    }
    printf("%d\n", s);
  }
  return 0;
}
