#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int c = 0;
  while (s.length() != 1) {
    c++;
    long long sum = 0;
    for (int i = 0; i < s.length(); i++) {
      sum += s[i] - '0';
    }
    s = to_string(sum);
  }
  cout << c << endl;
  return 0;
}
