#include <bits/stdc++.h>
using namespace std;
bool found = false;
string con(int od) {
  stringstream st;
  st << od;
  string pr;
  st >> pr;
  return pr;
}
int main() {
  string str;
  cin >> str;
  if (str.length() == 1)
    cout << "0";
  else {
    int s = 0;
    int c = 0;
    for (int i = 0; i < str.length(); i++) {
      s += (int)(str[i] - '0');
      if (i + 1 == str.length()) {
        ++c;
        if (s < 10) {
          cout << c;
          return 0;
        } else {
          str = con(s);
          s = 0;
          i = -1;
        }
      }
    }
  }
  return 0;
}
