#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie();
  ;
  string x;
  cin >> x;
  if (x.size() > 1) {
    long long cont = 0, i = 0;
    long long tam = 0;
    do {
      for (int i = 0; i < x.size(); i++) cont += x[i] - 48;
      i++;
      x = "";
      x = to_string(cont);
      tam = log10(cont) + 1;
      cont = 0;
    } while (tam > 1);
    cout << i << endl;
  } else {
    cout << 0 << endl;
  }
  return 0;
}
