#include <bits/stdc++.h>
using namespace std;
long long f(long long n, int ans) {
  if (n < 10) return ans;
  int s = 0;
  while (n > 0) {
    s += n % 10;
    n /= 10;
  }
  return f(s, ans + 1);
}
int main() {
  string a;
  long long s = 0;
  cin >> a;
  for (int i = 0; i < a.size(); i++) s += (int(a[i]) - 48);
  if (a.size() == 1)
    cout << 0 << endl;
  else
    cout << f(s, 1) << endl;
  return 0;
}
