#include <bits/stdc++.h>
using namespace std;
const int MAXL = 100002;
int sum_digits(char *num) {
  int sum = 0;
  for (int i = 0, len = strlen(num); i < len; ++i) {
    sum += num[i] - '0';
  }
  int res = 1;
  while (sum >= 10) {
    int n = 0;
    while (sum > 0) {
      n += sum % 10;
      sum /= 10;
    }
    sum = n;
    ++res;
  }
  return res;
}
void solve() {
  char num[MAXL];
  scanf("%s", num);
  if (strlen(num) == 1) {
    printf("0\n");
  } else {
    int ans = sum_digits(num);
    printf("%d\n", ans);
  }
}
int main() {
  solve();
  return 0;
}
