#include <bits/stdc++.h>
using namespace std;
int arr[1000 + 123];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  string s;
  cin >> s;
  int cnt = 0;
  while (s.size() != 1) {
    int sum = 0;
    for (auto u : s) {
      sum += u - '0';
    }
    s = to_string(sum);
    cnt++;
  }
  cout << cnt << endl;
  return 0;
}
