#include <bits/stdc++.h>
using namespace std;
int main() {
  string n;
  cin >> n;
  int cnt = 0;
  while (n.length() > 1) {
    int s = 0;
    for (int i = 0; i < n.length(); i++) s += n[i] - 48;
    cnt++;
    n = to_string(s);
  }
  cout << cnt;
}
