#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
using namespace std;
int main() {
  string s;
  int c = 0, k = 0;
  cin >> s;
  while (s.size() > 1) {
    k = 0;
    for (int i = 0; i < s.size(); i++) {
      k += s[i] - '0';
    }
    s = to_string(k);
    c++;
  }
  cout << c;
  return 0;
}
