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