#include <bits/stdc++.h>
using namespace std;
int a[50];
int main(int argc, char *argv[]) {
  int n = 0, h, y = 0, s = 0;
  string t;
  cin >> t;
  if (t == "0" || t == "1" || t == "2" || t == "3" || t == "4" || t == "5" ||
      t == "6" || t == "7" || t == "8" || t == "9") {
    cout << 0;
    return 0;
  }
  for (int i = 0; i < t.length(); i++) {
    n += t[i] - '0';
  }
  while (n >= 10) {
    h = n;
    n = 0;
    while (h > 0) {
      n += h % 10;
      h = h / 10;
      y++;
    }
    s++;
  }
  cout << s + 1;
  return EXIT_SUCCESS;
}
