#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cout.tie(0);
  cin.tie(0);
  string s;
  cin >> s;
  if (s[1] == '\0' && s[0] >= '0' && s[0] <= '9') {
    cout << 0 << endl;
    return 0;
  }
  long long int x = 0;
  for (int i = 0; s[i]; ++i) x += s[i] - '0';
  int cnt = 1;
  while (x > 9) {
    long long int y = 0;
    while (x) {
      y += (x % 10);
      x /= 10;
    }
    x = y;
    cnt++;
  }
  cout << cnt << endl;
  return 0;
}
