#include <bits/stdc++.h>
using namespace std;
const long double epsilon = 1e-9;
int main() {
  string str;
  cin >> str;
  if (str.size() < 2) {
    cout << 0 << endl;
    return 0;
  }
  int sum = 0;
  for (int i = 0; i < str.size(); i++) sum += str[i] - '0';
  int cnt = 1;
  while (sum >= 10) {
    cnt++;
    int tmp = sum;
    sum = 0;
    while (tmp > 0) {
      sum += tmp % 10;
      tmp /= 10;
    }
  }
  cout << cnt << endl;
  return 0;
}
