#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  string s;
  cin >> s;
  long long int sum = 0;
  long long int count = 0;
  if (s.length() > 1) count = 1;
  for (long long int i = 0; i < s.length(); i++) sum += s[i] - 48;
  while (sum / 10) {
    vector<long long int> v;
    long long int k = sum;
    while (k) {
      long long int rem = k % 10;
      v.push_back(rem);
      k /= 10;
    }
    sum = 0;
    for (long long int i = 0; i < v.size(); i++) sum += v[i];
    count++;
  }
  cout << count;
}
