#include <bits/stdc++.h>
using namespace std;
long long sum(const string& num) {
  long long ret = 0;
  for (int i = 0; i < num.length(); i++) {
    ret += (num[i] - '0');
  }
  return ret;
}
string toString(long long num) {
  string ret;
  while (num) {
    ret = char(num % 10 + '0') + ret;
    num /= 10;
  }
  return ret;
}
int main() {
  string s;
  cin >> s;
  int count = 0;
  while (s.length() != 1) {
    ++count;
    s = toString(sum(s));
  }
  cout << count << '\n';
}
