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