#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  int x, y = 0;
  cin >> s;
  if (s.size() == 1) {
    cout << '0' << endl;
    return 0;
  } else {
    do {
      x = 0;
      for (int i = 0; i < s.size(); i++) x += s[i] - '0';
      s = std::to_string(x);
      y++;
    } while (s.size() > 1);
  }
  cout << y << endl;
  return 0;
}
