#include <bits/stdc++.h>
using namespace std;
inline int sum(int x) {
  int res = 0;
  while (x) {
    res += x % 10;
    x /= 10;
  }
  return res;
}
int main() {
  char c;
  int n = 0;
  int cnt = 0;
  while (cin >> c) {
    n += c - '0';
    cnt++;
  }
  if (cnt == 1) {
    cout << 0;
    return 0;
  }
  cnt = 1;
  while (n >= 10) {
    n = sum(n);
    cnt++;
  }
  cout << cnt;
  return 0;
}
