#include <bits/stdc++.h>
using namespace std;
int rec(string x) {
  int sz = x.size();
  int ans = 0;
  for (int i = 0; i < sz; i++) {
    ans += (x[i] - '0');
  }
  if (ans <= 9) {
    return 1;
  }
  string newx = "";
  while (ans >= 1) {
    int d = ans % 10;
    newx = (char)('0' + d) + newx;
    ans /= 10;
  }
  return 1 + rec(newx);
}
int main(int argc, char *argv[]) {
  string line;
  cin >> line;
  if (line.size() <= 1) {
    cout << "0" << endl;
  } else {
    cout << rec(line) << endl;
  }
  return 0;
}
