#include <bits/stdc++.h>
using namespace std;
void fast() {
  std::ios_base::sync_with_stdio(0);
  cin.tie(NULL);
}
int main() {
  fast();
  string str;
  cin >> str;
  if (str.size() == 1)
    cout << 0 << endl;
  else {
    int steps = 0;
    long long cnt = 0;
    stringstream ss;
    ss << str;
    while (true) {
      string word = ss.str();
      for (int i = 0; i < word.size(); i++) cnt += word[i] - 48;
      ss.str("");
      ss << cnt;
      steps++;
      if (ss.str().size() == 1) break;
      cnt = 0;
      word.clear();
    }
    cout << steps << endl;
  }
  return 0;
}
