#include <bits/stdc++.h>
int main() {
  int c;
  int a = 0, s, count = 0;
  while ((c = getchar()) != EOF && c != '\n') {
    a += c - '0';
    count++;
  }
  if (count == 1) {
    printf("0");
    return 0;
  }
  count = 1;
  while (a >= 10) {
    s = 0;
    while (a) {
      s += a % 10;
      a /= 10;
    }
    a = s;
    count++;
  }
  printf("%d", count);
  return 0;
}
