#include <bits/stdc++.h>
using namespace std;
int main() {
  int i, sum, t = 0;
  string s;
  cin >> s;
  while (s.length() > 1) {
    sum = 0;
    for (i = 0; i < s.length(); i++) sum += (s[i] - '0');
    s = to_string(sum);
    t++;
  }
  printf("%d", t);
}
