#include <bits/stdc++.h>
using namespace std;
string summ(string s, int count) {
  int n = 0;
  while (s[n] != '\0') {
    n++;
  }
  if (n == 1) {
    return to_string(count);
  } else {
    int sum = 0;
    for (int i = 0; i < n; i++) {
      sum += int(s[i]) - 48;
    }
    return summ(to_string(sum), count + 1);
  }
}
int main() {
  string s;
  cin >> s;
  cout << summ(s, 0);
}
