#include <bits/stdc++.h>
using namespace std;
static const double EPS = 1e-5;
int main() {
  string c;
  int curnum = 0;
  cin >> c;
  if (c.size() == 1) {
    cout << 0 << endl;
  } else {
    for (int i = 0; i < (int)c.size(); i++) {
      curnum += c[i] - '0';
    }
    int ans = 1;
    while (curnum >= 10) {
      int nextnum = 0;
      while (curnum != 0) {
        nextnum += curnum % 10;
        curnum /= 10;
      }
      curnum = nextnum;
      ans++;
    }
    cout << ans << endl;
  }
  return 0;
}
