#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  int x = 0, cnt = 0;
  cin >> s;
  while (s.length() > 1) {
    for (int i = 0; i < s.length(); i++) {
      x += s[i] - 48;
    }
    ostringstream convert;
    convert << x;
    s = convert.str();
    cnt++;
    x = 0;
  }
  cout << cnt << endl;
  return 0;
}
