#include <bits/stdc++.h>
using namespace std;
int main() {
  string num;
  cin >> num;
  long long n;
  n = 0;
  long long cost = 0;
  for (int i = 0; i < num.size(); i++) {
    n += (num[i] - '0');
  }
  if (n == 0 || num.size() == 1) {
    cout << 0;
    return 0;
  }
  cost++;
  while (n / 10 != 0) {
    long long currN = n;
    n = 0;
    while (currN != 0) {
      n += currN % 10;
      currN /= 10;
    }
    cost++;
  }
  cout << cost;
  return 0;
}
