#include <bits/stdc++.h>
using namespace std;
int main() {
  string n;
  cin >> n;
  int ans = 0;
  while (n.size() > 1) {
    int k = 0;
    for (int i = 0; i < n.size(); i++) {
      k += n[i] - 48;
    }
    ans++;
    stringstream ss;
    ss << k;
    string str = ss.str();
    n = str;
  }
  cout << ans;
}
