#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int sum = 0, spell = (s.size() > 1);
  for (int i = 0; s[i]; i++) sum += s[i] - '0';
  while (sum >= 10) {
    int sum1 = 0;
    while (sum) {
      sum1 += sum % 10;
      sum /= 10;
    }
    sum = sum1;
    spell++;
  }
  cout << spell << '\n';
  return 0;
}
