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