#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e6;
const long long MOD = 1e9 + 7;
const long long N = 1e6 + 7;
const long long N_N = 1e3;
const int INF = 1e9 + 228;
const long double eps = 1e-12;
long long n, m, a[N], res, cnt, ans;
string s, t;
int main() {
  cin >> s;
  while (s.size() > 1) {
    ans = 0;
    for (long long i = 0; i < s.size(); ++i) {
      ans += s[i] - '0';
    }
    s = "";
    while (ans) {
      s += ans % 10 + '0';
      ans /= 10;
    }
    res++;
  }
  cout << res;
  return 0;
}
