#include <bits/stdc++.h>
using namespace std;
int main() {
  int i, c = 0, p;
  string a;
  cin >> a;
  int l = a.size();
  while (l > 1) {
    int s = 0;
    for (i = 0; i < l; i++) {
      s += a[i] - '0';
    }
    a = to_string(s);
    l = a.size();
    c++;
  }
  cout << c << endl;
}
