#include <bits/stdc++.h>
using namespace std;
int main() {
  int x = 0, ba2y = 0, sum = 0, z = 0, s = 0;
  string n, m;
  cin >> n;
  while (n.size() > 1) {
    z = 0;
    for (int i = 0; i < n.size(); i++) {
      z += n[i] - '0';
    }
    s++;
    n = to_string(z);
  }
  cout << s;
}
