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