#include <bits/stdc++.h>
using namespace std;
void print(vector<long long> v);
void fastio();
string check(string s) {
  long long temp = 0;
  for (long long i = 0; i < s.length(); ++i) {
    temp += (s[i] - '0');
  }
  s = to_string(temp);
  return s;
}
void solve() {
  string s;
  cin >> s;
  if (s.size() == 1) {
    cout << 0;
    return;
  }
  long long temp = 0;
  while (1) {
    temp++;
    s = check(s);
    if (s.size() == 1) break;
  }
  cout << temp;
}
int32_t main() {
  fastio();
  long long t = 1;
  while (t--) {
    solve();
  }
}
void print(vector<long long> v) {
  for (auto x : v) {
    cout << x << " ";
  }
  cout << "\n";
}
void fastio() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
}
