#include <bits/stdc++.h>
using namespace std;
char m[100001];
char f[100001];
int sum(char *a) {
  static int count = 0;
  int q = 0;
  int w = strlen(a);
  if (w == 1)
    return count;
  else {
    for (int j = 0; j < w; j++) {
      char r = a[j];
      q += atol((char *)&r);
    }
  }
  sprintf(f, "%d", q);
  count++;
  return sum(f);
}
int main() {
  cin >> m;
  int t = sum(m);
  cout << t;
  return 0;
}
