#include <bits/stdc++.h>
using namespace std;
int main() {
  string str;
  int counter = 0;
  cin >> str;
  while (str.size() > 1) {
    unsigned long long sum = 0;
    for (int i = 0; i < str.size(); i++) {
      sum += str[i] - '0';
    }
    str = to_string(sum);
    counter += 1;
  }
  cout << counter;
}
