#include <bits/stdc++.h>
using namespace std;
template <class T>
string tostring(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}
template <class T>
int toint(T s) {
  int v;
  istringstream sin(tostring(s));
  sin >> v;
  return v;
}
vector<string> split(string sentence) {
  istringstream iss(sentence);
  vector<string> tokens;
  copy(istream_iterator<string>(iss), istream_iterator<string>(),
       back_inserter<vector<string> >(tokens));
  return tokens;
}
string conversion(int a, int b) {
  string cambio;
  int suma = 0;
  int coci = a;
  while (coci > 0) {
    cambio += tostring(coci % b);
    coci = coci / b;
  }
  return string(cambio.rbegin(), cambio.rend());
}
int GCD(int a, int b) {
  if (a % b == 0)
    return b;
  else
    return GCD(b, a % b);
}
int main() {
  string n;
  cin >> n;
  int count = 0;
  string h;
  bool si = true;
  if (n.size() == 1) {
    cout << count;
    return 0;
  } else {
    while (si) {
      int k = 0;
      for (int i = 0; i < n.size(); i++) {
        k += n[i] - '0';
      }
      count++;
      h = tostring(k);
      if (h.size() == 1) si = false;
      n = h;
    }
    cout << count;
  }
  return 0;
}
