#include <bits/stdc++.h>
using namespace std;
long long sod(string s) {
  int ans = 0, len = s.size();
  for (int i = 0; i < len; i++) {
    ans += (s[i] - '0');
  }
  return ans;
}
long long sodnum(long long n) {
  int ans = 0;
  while (n) {
    int r = n % 10;
    ans += r;
    n /= 10;
  }
  return ans;
}
int main() {
  string s;
  cin >> s;
  int cnt = 0;
  long long n = sod(s);
  if (n > 9 || s.size() > 1) cnt++;
  while (n >= 10) {
    cnt++;
    n = sodnum(n);
  }
  printf("%d\n", cnt);
}
