#include <bits/stdc++.h>
using namespace std;
map<long long, long long> mp;
vector<long long> vn, vp;
long long ar[202020], br[202020], ans[202020], frq[202020], xi[202020];
long long a, b, c, d, x, y, t, n, m, con = 0, sum = 0, sum1 = 0, mx = 0,
                                     mn = 1e18;
bool f = 0;
pair<long long, long long> p[202020];
int main() {
  string s;
  cin >> s;
  if (s.size() > 1) con++;
  for (int i = 0; i < s.size(); i++) sum += s[i] - '0';
  while (sum / 10) {
    con++;
    sum1 = 0;
    while (sum) {
      sum1 += sum % 10;
      sum /= 10;
    }
    sum = sum1;
  }
  cout << con;
}
