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