#include <bits/stdc++.h>
using namespace std;
int main() {
  string mario;
  cin >> mario;
  long long sum = 0;
  if (mario.size() == 1) {
    cout << 0;
    return 0;
  }
  int c = 1;
  for (int i = 0; i < mario.size(); i++) {
    sum += mario[i] - '0';
  }
  if (sum >= 0 && sum <= 9) {
    cout << 1;
    return 0;
  }
  long long sum2 = 0;
  {
    while (1) {
      c++;
      while (sum > 0) {
        int mod = sum % 10;
        sum2 += mod;
        sum /= 10;
      }
      if (sum2 >= 0 && sum2 <= 9) {
        break;
      } else {
        sum = sum2;
        sum2 = 0;
      }
    }
  }
  cout << c;
  return 0;
}
