#include <bits/stdc++.h>
#pragma optimization_level 3
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
const long long MAX5 = 1e+5 + 7;
const long long MAX7 = 1e+7 + 7;
const long long INF = 0x7f7f7f7f7f7f7f7f;
const int INFi = 0x7f7f7f7f;
const long long MOD = 1e+9 + 7;
long long n = 0, cou = 0, sum;
string second;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cout << fixed;
  cout << setprecision(12);
  ;
  cin >> second;
  if (second.length() == 1) {
    cout << 0;
    cout << "\n";
    return 0;
  }
  for (char i : second) {
    n += (i - 48);
  }
  cou = 1;
  while (n > 9) {
    cou++;
    sum = 0;
    while (n) {
      sum += n % 10;
      n /= 10;
    }
    n = sum;
  }
  cout << cou;
  cout << "\n";
  return 0;
}
