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