#include <bits/stdc++.h>
using namespace std;
int cnt;
char s[100100];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> s;
  while (s[1]) {
    cnt++;
    int res = 0;
    for (int i = 0; s[i]; i++) res += s[i] - '0';
    sprintf(s, "%d", res);
  }
  cout << cnt;
}
