#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const int len = 1e6 + 4;
const long long MAX = 1e18;
int main() {
  string str;
  while (cin >> str) {
    if (str.size() <= 1)
      puts("0");
    else {
      long long count = 1;
      long long sum = 0;
      for (int i = 0; i < str.size(); ++i) sum += str[i] - '0';
      long long x = 0;
      while (sum >= 10) {
        count++;
        x = 0;
        while (sum) {
          x += sum % 10;
          sum /= 10;
        }
        sum = x;
      }
      cout << count << endl;
    }
  }
}
