#include <bits/stdc++.h>
using namespace std;
char buf[100001];
int main() {
  int N, M, L, len, sum = 0;
  gets(buf);
  len = strlen(buf);
  if (len == 1)
    sum = 0;
  else {
    int tmp = 0;
    for (int i = 0; i < len; i++) tmp += buf[i] - '0';
    sum = 1;
    while (tmp > 9) {
      sum++;
      int k = 0;
      while (tmp) {
        k += tmp % 10;
        tmp /= 10;
      }
      tmp = k;
    }
  }
  printf("%d\n", sum);
  return 0;
}
