#include <bits/stdc++.h>
using namespace std;
int ans, T, i, j, k, flag = 0, Sum;
string str, n;
int main() {
  cin >> n;
  while (n.length() > 1) {
    Sum = 0;
    for (i = n.length() - 1; i >= 0; i--) {
      Sum += int(n[i]) - 48;
    }
    if (Sum < 9) {
      flag++;
      break;
    }
    flag++;
    n = to_string(Sum);
  }
  cout << flag;
  return 0;
}
