#include <bits/stdc++.h>
using namespace std;
int main() {
  int sum = 100, counter = 0;
  string s, k;
  cin >> s;
  while (s.size() > 1) {
    sum = 0;
    for (int i = 0; i < s.size(); i++) {
      sum += s[i] - '0';
    }
    counter++;
    stringstream ss;
    ss << sum;
    ss >> s;
  }
  cout << counter << endl;
  return 0;
}
