#include <bits/stdc++.h>
using namespace std;
void check(string str) {
  long long int temp, i, cnt = 0;
  char chr;
  while (str.length() > 1) {
    temp = 0;
    for (i = 0; i < str.length(); ++i) {
      chr = str[i];
      temp += chr - '0';
    }
    stringstream ss;
    ss << temp;
    str = ss.str();
    cnt++;
  }
  cout << cnt;
}
int main() {
  string str;
  cin >> str;
  check(str);
  return 0;
}
