#include <algorithm>
#include <array>
#include <bitset>
#include <cctype>
#include <chrono>
#include <cmath>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iso646.h>
#include <iterator>
#include <list>
#include <map>
#include <memory>
#include <numeric>
/*                           mnciitbhu                        */
//
//  |\    /| |\    |    --  |  |  -------  |⎻⎻\   |   |  |    |
//  | \  / | | \   |   /    |  |     |     |   |  |   |  |    |
//  |  \/  | |  \  |  (     |  |     |     |--<   |---|  |    |
//  |      | |   \ |   \    |  |     |     |   |  |   |   \  /
//  |      | |    \|    --  |  |     |     |__/   |   |    --
//
#include <queue>
#include <ratio>
#include <regex>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <valarray>
#include <vector>
using namespace std;
using namespace std::chrono;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
#if not defined(ONLINE_JUDGE) && not defined(_MSVC_LANG) && defined(DEBUG_)
#include "myconfig.hpp"
#else
#define LOL(x) ;
#define LOLX(...) ;
#endif
#if not defined(DEBUG_)
#endif
int main() 
{
	ios::sync_with_stdio(false);
	cin.tie(0);

	string s;
	cin >> s;
	ll ans = 0;
	while(s.size() != 1)
	{
		LOL(s);
		ll sm = 0;
		for(auto x : s)
			sm += x - '0';
		s = to_string(sm);
		ans++;
	}
	cout << ans;

	return 0;
}
