#include <bits/stdc++.h>
using namespace std;
int main() {
  long long i, n, t, k, j, x = 0, y = 0, m;
  string str;
  cin >> str;
  while (str.size() != 1) {
    x = 0;
    for (i = 0; i < str.size(); i++) {
      x += str[i] - 48;
    }
    str = to_string(x);
    y++;
  }
  printf("%I64d\n", y);
  return 0;
}
