#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  string s;
  cin >> s;
  int sum = 0;
  int con = 0, ans = 0;
  if (s.size() == 1) {
    cout << 0;
  } else {
    for (int i = 0; i < s.size(); i++) {
      sum += s[i] - '0';
    }
    ans++;
    while (1) {
      int b = sum;
      int n = 0;
      con = 0;
      while (b > 0) {
        b /= 10;
        con++;
      }
      if (con == 1) {
        cout << ans;
        break;
      } else {
        while (sum > 0) {
          n += sum % 10;
          sum /= 10;
        }
        sum = n;
        ans++;
      }
    }
  }
  return 0;
}
