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