#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  int num = 0, ans = 0;
  cin >> s;
  for (int i = 0; i < s.size(); ++i) num += s[i] - '0';
  if (s.size() != 1) {
    ++ans;
    while (num >= 10) {
      int ind = 0;
      while (num) ind += num % 10, num /= 10;
      num = ind;
      ++ans;
    }
  }
  printf("%d\n", ans);
}
