#include <bits/stdc++.h>
using namespace std;
int main() {
  string str;
  cin >> str;
  int count = 0;
  while (str.size() > 1) {
    string temp;
    int num = 0;
    count++;
    for (int i = 0; i < str.size(); i++) {
      num += str[i] - 48;
    }
    str = "";
    str = to_string(num);
  }
  cout << count << endl;
  return 0;
}
