#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  string s;
  cin >> s;
  int count = 0;
  while (s.size() != 1) {
    int sum = 0;
    for (int i = 0; i < s.size(); i++) sum += s[i] - 48;
    string res = "";
    while (sum) {
      int digit = sum % 10;
      sum /= 10;
      res += (char)(digit + 48);
    }
    s = res;
    count++;
  }
  cout << count;
}
