//By Lin
#include<cstdio>
#include<cstring>
#include<algorithm>
#define maxn 200005

using namespace std;

char s[maxn];
int	 sum[maxn],que[maxn],cnt,data[maxn],n,m;

int	find(int key)
{
	int g = 0 , h = cnt-1 , ret = -1;
	while ( g <=h )
	{
		int mid = (g+h)/2;
		if ( data[que[mid]] >= key )
		{
			ret = mid;
			h = mid-1;
		}
		else g = mid + 1;
	}
	return ret;
}
int main()
{
	int n = 0;
	char ch;
	ch = getchar();
	while ( ('A' <= ch && ch <='Z') || ('a' <= ch && ch <='z') )
	{
		s[n++] = ch;
		ch = getchar();
	}

	s[n] = 0;
	m = 0;
	data[m++] = -1;

	sum[0] = 0;
	for (int i = 0; i<n; i++)
	{
		sum[i+1] = sum[i];
		if ( s[i] == 'a' || s[i] == 'e' || s[i] == 'i' || s[i] == 'o' || s[i] == 'u' ||
			 s[i] == 'A' || s[i] == 'E' || s[i] == 'I' || s[i] == 'O' || s[i] == 'U' )
			sum[i+1]++;
	}
	for (int i = 0; i<=n; i++)
		data[i] = 3*sum[i] - 2*i;

	que[0] = 0;
	cnt = 1;
	int ans = -1;
	for (int i = 1; i<=n; i++)
	{
		if ( data[i] > data[que[cnt-1]] )
			que[cnt++] = i;
		int k = find(data[i]);
		ans = max(ans,i-que[k]);
	}
	if ( ans <=0 ) printf("No solution\n");
	else
	{
		cnt = 0;
		for (int i = ans; i<=n; i++)
		{
			if ( data[i] <= data[i-ans] ) cnt ++;
		}
		printf("%d %d\n" , ans ,cnt);
	}
	return 0;
}


//By Lin
#include<cstdio>
#include<cstring>
#include<algorithm>
#define maxn 200005

using namespace std;

char s[maxn];
int	 sum[maxn],que[maxn],cnt,data[maxn],n,m;

int	find(int key)
{
	int g = 0 , h = cnt-1 , ret = -1;
	while ( g <=h )
	{
		int mid = (g+h)/2;
		if ( data[que[mid]] >= key )
		{
			ret = mid;
			h = mid-1;
		}
		else g = mid + 1;
	}
	return ret;
}
int main()
{
	int n = 0;
	char ch;
	ch = getchar();
	while ( ('A' <= ch && ch <='Z') || ('a' <= ch && ch <='z') )
	{
		s[n++] = ch;
		ch = getchar();
	}

	s[n] = 0;
	m = 0;
	data[m++] = -1;

	sum[0] = 0;
	for (int i = 0; i<strlen(s); i++)
	{
		sum[i+1] = sum[i];
		if ( s[i] == 'a' || s[i] == 'e' || s[i] == 'i' || s[i] == 'o' || s[i] == 'u' ||
			 s[i] == 'A' || s[i] == 'E' || s[i] == 'I' || s[i] == 'O' || s[i] == 'U' )
			sum[i+1]++;
	}
	for (int i = 0; i<=n; i++)
		data[i] = 3*sum[i] - 2*i;

	que[0] = 0;
	cnt = 1;
	int ans = -1;
	for (int i = 1; i<=n; i++)
	{
		if ( data[i] > data[que[cnt-1]] )
			que[cnt++] = i;
		int k = find(data[i]);
		ans = max(ans,i-que[k]);
	}
	if ( ans <=0 ) printf("No solution\n");
	else
	{
		cnt = 0;
		for (int i = ans; i<=n; i++)
		{
			if ( data[i] <= data[i-ans] ) cnt ++;
		}
		printf("%d %d\n" , ans ,cnt);
	}
	return 0;
}


//By Lin
#include<cstdio>
#include<cstring>
#include<algorithm>
#define maxn 200005

using namespace std;

char s[maxn];
int	 sum[maxn],que[maxn],cnt,data[maxn],n,m;

int	find(int key)
{
	int g = 0 , h = cnt-1 , ret = -1;
	while ( g <=h )
	{
		int mid = (g+h)/2;
		if ( data[que[mid]] >= key )
		{
			ret = mid;
			h = mid-1;
		}
		else g = mid + 1;
	}
	return ret;
}
int main()
{
	scanf("%s" , s );
	n = strlen(s);
	m = 0;
	data[m++] = -1;

	sum[0] = 0;
	for (int i = 0; i<strlen(s); i++)
	{
		sum[i+1] = sum[i];
		if ( s[i] == 'a' || s[i] == 'e' || s[i] == 'i' || s[i] == 'o' || s[i] == 'u' ||
			 s[i] == 'A' || s[i] == 'E' || s[i] == 'I' || s[i] == 'O' || s[i] == 'U' )
			sum[i+1]++;
	}
	for (int i = 0; i<=n; i++)
		data[i] = 3*sum[i] - 2*i;

	que[0] = 0;
	cnt = 1;
	int ans = -1;
	for (int i = 1; i<=n; i++)
	{
		if ( data[i] > data[que[cnt-1]] )
			que[cnt++] = i;
		int k = find(data[i]);
		ans = max(ans,i-que[k]);
	}
	if ( ans <=0 ) printf("No solution\n");
	else
	{
		cnt = 0;
		for (int i = ans; i<=n; i++)
		{
			if ( data[i] <= data[i-ans] ) cnt ++;
		}
		printf("%d %d\n" , ans ,cnt);
	}
	return 0;
}


//By Lin
#include<cstdio>
#include<cstring>
#include<algorithm>
#define maxn 200005

using namespace std;

char s[maxn];
int  data[maxn],n,m,sum[maxn];

int	pan(int k)
{
	int ret = -1;
	for (int i = 0; i<m-k; i++)
	{
		if ( 2*(data[i+k+1] - data[i]-1) >= k*3 )
			ret = max(data[i+k+1]-data[i]-1,ret);
	}
	return ret;
}

int main()
{
	scanf("%s" , s );
	n = strlen(s);
	m = 0;
	data[m++] = -1;

	sum[0] = 0;
	for (int i = 0; i<strlen(s); i++)
	{
		sum[i+1] = sum[i];
		if ( s[i] == 'a' || s[i] == 'e' || s[i] == 'i' || s[i] == 'o' || s[i] == 'u' ||
			 s[i] == 'A' || s[i] == 'E' || s[i] == 'I' || s[i] == 'O' || s[i] == 'U' )
		{
			data[m++] = i;
			sum[i+1]++;
		}
	}
	data[m++] = n;
	int g = 0 , h = m;
	int ans = -1;
	while ( g <= h )
	{
		int mid = (g+h)/2;
		int k = pan(mid);
		if ( k == -1 ) h = mid-1;
		else
		{
			ans = k;
			g = mid + 1;
		}
	}
	if ( ans <= 0 )
	{
		printf("No solution\n");
		return 0;
	}
	int cnt = 0;
	for (int i = 1; i<=n-ans+1; i++)
	{
		int v =  sum[i+ans-1] - sum[i-1];
		if ( 2*ans >= 3*v ) cnt ++;
	}
	printf("%d %d\n" , ans , cnt );

	return 0;
}


//By Lin
#include<cstdio>
#include<cstring>
#include<algorithm>
#define maxn 200005

using namespace std;

char s[maxn];
int  data[maxn],n,m,sum[maxn];

bool	pan(int k)
{
	for (int i = 0; i<m-k; i++)
	{
		if ( 2*(data[i+k+1] - data[i]-1) >= k*3 )  return true;
	}
	return false;
}

int	solve(int k)
{
	int ret = -1;
	for (int i = 0; i<m-k; i++)
	{
		if ( 2*(data[i+k+1] - data[i]-1) >= k*3 )
			ret = max(data[i+k+1]-data[i]-1,ret);
	}
	return ret;
}

int main()
{
	scanf("%s" , s );
	n = strlen(s);
	m = 0;
	data[m++] = -1;

	sum[0] = 0;
	int w = 0;
	for (int i = 0; i<strlen(s); i++)
	{
		sum[i+1] = sum[i];
		if ( s[i] == 'a' || s[i] == 'e' || s[i] == 'i' || s[i] == 'o' || s[i] == 'u' ||
			 s[i] == 'A' || s[i] == 'E' || s[i] == 'I' || s[i] == 'O' || s[i] == 'U' )
		{
			data[m++] = i;
			sum[i+1]++;
		}
		else w++;
	}
	data[m++] = n;
	int g = 0 , h = m,t;
	h = min(w*2,h);
	while ( g <= h )
	{
		int mid = (g+h)/2;
		if ( !pan(mid) ) h = mid-1;
		else
		{
			t = mid;
			g = mid + 1;
		}
	}
	int ans = solve(t);
	if ( ans <= 0 )
	{
		printf("No solution\n");
		return 0;
	}
	int cnt = 0;
	for (int i = 1; i<=n-ans+1; i++)
	{
		int v =  sum[i+ans-1] - sum[i-1];
		if ( 2*ans >= 3*v ) cnt ++;
	}
	printf("%d %d\n" , ans , cnt );

	return 0;
}


//By Lin
#include<cstdio>
#include<cstring>
#include<algorithm>
#define maxn 200005

using namespace std;

char s[maxn];
int  sum[maxn],que[maxn],cnt,data[maxn],n,m;

int find(int key)
{
    int g = 0 , h = cnt-1 , ret = -1;
    while ( g <=h )
    {
        int mid = (g+h)/2;
        if ( data[que[mid]] >= key )
        {
            ret = mid;
            h = mid-1;
        }
        else g = mid + 1;
    }
    return ret;
}
int main()
{
    int n = 0;
    char ch;
    ch = getchar();
    while ( ('A' <= ch && ch <='Z') || ('a' <= ch && ch <='z') )
    {
        s[n++] = ch;
        ch = getchar();
    }

    s[n] = 0;
    m = 0;
    data[m++] = -1;

    sum[0] = 0;
    for (int i = 0; i<n; i++)
    {
        sum[i+1] = sum[i];
        if ( s[i] == 'a' || s[i] == 'e' || s[i] == 'i' || s[i] == 'o' || s[i] == 'u' ||
             s[i] == 'A' || s[i] == 'E' || s[i] == 'I' || s[i] == 'O' || s[i] == 'U' )
            sum[i+1]++;
    }
    for (int i = 0; i<=n; i++)
        data[i] = 3*sum[i] - 2*i;

    que[0] = 0;
    cnt = 1;
    int ans = -1;
    for (int i = 1; i<=n; i++)
    {
        if ( data[i] > data[que[cnt-1]] )
            que[cnt++] = i;
        int k = find(data[i]);
        ans = max(ans,i-que[k]);
    }
    if ( ans <=0 ) printf("No solution\n");
    else
    {
        cnt = 0;
        for (int i = ans; i<=n; i++)
        {
            if ( data[i] <= data[i-ans] ) cnt ++;
        }
        printf("%d %d\n" , ans ,cnt);
    }
    return 0;
}


#include<iostream>
#include<stdio.h>
#include<string.h>
using namespace std;
char str[200010];
int main()
{
    cin>>str;
    int len=strlen(str),v=0,c=0,ans=0,count=0;
    for(int i=0;i<len;i++)
    {
            if(str[i]=='a' || str[i]=='e' || str[i]=='i' || str[i]=='o' || str[i]=='u' || str[i]=='A' || str[i]=='E' || str[i]=='I' || str[i]=='O' || str[i]=='U')
                v++;
            else
               c++;
            if(2*c>=v)
               ans=max(ans,c+v);
            else
               ans=max(ans,3*c-ans);
    }
    if(ans==0)
    cout<<"No solution";
    else
    {
        count=0;
        for(int i=0;i+ans-1<len;i++)
        {
            v=0;c=0;
            for(int j=0;j<ans;j++)
            {
               if(str[i+j]=='a' || str[i+j]=='e' || str[i+j]=='i' || str[i+j]=='o' || str[i+j]=='u' || str[i+j]=='A' || str[i+j]=='E' || str[i+j]=='I' || str[i+j]=='O' || str[i+j]=='U')
                  v++;
               else
                  c++;
               if(2*c>=v)
               {
                  if(c+v==ans)
                  count++;
               }
            }
        }
        cout<<ans<<" "<<count;
    }
}


#include<iostream>
#include<stdio.h>
#include<string.h>
using namespace std;
char str[200010];
int main()
{
    cin>>str;
    int len=strlen(str),v=0,c=0,ans=0,count=0;
    for(int i=0;i<len;i++)
    {
            if(str[i]=='a' || str[i]=='e' || str[i]=='i' || str[i]=='o' || str[i]=='u' || str[i]=='A' || str[i]=='E' || str[i]=='I' || str[i]=='O' || str[i]=='U')
                v++;
            else
               c++;
            if(2*c>=v)
               ans=max(ans,c+v);
            else
            {
               ans=max(ans,3*c);
            }
    }
    if(ans==0)
    cout<<"No solution";
    else
    {
        count=0;
        for(int i=0;i+ans-1<len;i++)
        {
            v=0;c=0;
            for(int j=0;j<ans;j++)
            {
               if(str[i+j]=='a' || str[i+j]=='e' || str[i+j]=='i' || str[i+j]=='o' || str[i+j]=='u' || str[i+j]=='A' || str[i+j]=='E' || str[i+j]=='I' || str[i+j]=='O' || str[i+j]=='U')
                  v++;
               else
                  c++;
               if(2*c>=v)
               {
                  if(c+v==ans)
                  count++;
               }
            }
        }
        cout<<ans<<" "<<count;
    }
}
//baaaaab
//abaaaaaaabb
// abaaaaaabbaab


import java.util.*;
import java.lang.*;
import java.io.*;
public class Sum_of_digits {
	public static void main(String[] args) throws java.lang.Exception
	{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String s=br.readLine();
		if(s.length()==1) System.out.println(0);
		else {
			int count=0;
			while(s.length()>1) {
				int sum=0;
				for(int i=0; i<s.length(); i++) {
					sum+=Integer.parseInt(""+s.charAt(i));
				}
				++count;
				s=""+sum;//by using '+' function to convert integer to string
			}
			System.out.println(count);
		}
	}
}


import java.util.*;

public class Main {

    public static class Solution {

        public int sumOfDigits() {
            Scanner scanner = new Scanner(System.in);
            String s = scanner.nextLine();
            scanner.close();
            int sol = 0;

            while (s.length() > 1) {
                sol++;
                int count = 0;

                for (int i = 0; i < s.length(); i++) {
                    //use of Integer.parseInt to convert the character to integer
                    count += Integer.parseInt("" + s.charAt(i));
                }
                //again convert integer to string without Integer.toString function
                s = "" + count;
            }

            return sol;
        }

    }

    public static void main(String[] args) {
        Solution sol = new Solution();
        System.out.println(sol.sumOfDigits());

    }
}


import java.util.*;
import java.lang.*;
import java.io.*;
public class Sum_of_digits {

	public static void main(String[] args) throws java.lang.Exception
	{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String s=br.readLine();
		if(s.length()==1) System.out.println(0);
		else {
			int count=0;
			while(s.length()>1) {
				int sum=0;
				for(int i=0; i<s.length(); i++) {
					sum+=s.charAt(i)-48;
				}
				++count;
				s=Integer.toString(sum);
			}
			System.out.println(count);
		}
	}
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class B_Sum_of_Digits {
    public static void main(String[] args) throws IOException {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        String st = in.readLine();
        int sum = 0;
        int ans = 0;
        while(true) {
            int len = st.length();
            for (int i = 0; i < len; i++) {
                sum += (st.charAt(i) - '0');
            }
            ans++;
            st = String.valueOf(sum);
            sum = 0;
            if(st.length() == 1)break;
        }
        System.out.println(ans);

    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class B_Sum_of_Digits {
    public static void main(String[] args) throws IOException {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        String st = in.readLine();
        int sum = 0;
        int ans = 0;
        if(st.length() == 1){
            System.out.println(0);
            return;
        }
        while(true) {
            int len = st.length();
            for (int i = 0; i < len; i++) {
                sum += (st.charAt(i) - '0');
            }
            ans++;
            st = String.valueOf(sum);
            sum = 0;
            if(st.length() == 1)break;
        }
        System.out.println(ans);

    }
}


import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String st = in.nextLine();
        int sum;
        int ans = 0;
        while(st.length() != 1){
        	sum = 0;
        	for(int i = 0; i < st.length(); i++){
        		sum += st.charAt(i) - '0';
        	}
        	st = String.valueOf(sum);
        	ans++;
        }
        System.out.println(ans);

    }
}


import java.util.*;
public class interview {
	public static void main(String[] args) {
		spell();
		}

	public static void spell() {
		Scanner sc= new Scanner(System.in);
		int n= sc.nextInt();
		int r = 0;
		int c = 0;
		String s = n+"";
//		System.out.println(s);
		while (n>=10) {
			s = n+"";
//			System.out.println(s);

			for (int i =s.length()-1;i>=0;i--) {
				c += (int) (n / Math.pow(10, i));
//				System.out.println((int)(n / Math.pow(10, i)));
//				System.out.println((int) (n % Math.pow(10, i)));
				n = (int) (n % Math.pow(10, i));

			}
//			System.out.println("c "+c);
			r++;
			n=c;
			c=0;
//			break;
			}

		System.out.println(r);

		}

	public static void pylon() {
		Scanner sc= new Scanner(System.in);
		int n= sc.nextInt();
		int max = 0;
		for(int i=0;i<n;i++) {
			max = Math.max(max, sc.nextInt());
		}
		System.out.println(max);
	}

	public static void bearPolice() {
		Scanner sc= new Scanner(System.in);
		int n= sc.nextInt();
		int a= sc.nextInt();
		a=a-1;
		int [] cities = new int[n];
		int criminals =0;
		int r =0;
		int city_count=0;
		for (int i = 0;i<n;i++) {
		cities[i]=sc.nextInt();
		}
		for(int i=0; (a+i<n)||(a-i>=0);i++) {
//			System.out.println(i);
			if(i==0 && cities[a]==1) {
//				criminals++;
				r++;
				continue;
			}
			if(a+i<n) {
					city_count++;
					if(cities[a+i]==1) {
						criminals++;
					}
				}

			if(a-i>=0) {
				city_count++;
				if(cities[a-i]==1) {
					criminals++;
				}
			}

//			System.out.println(a+" "+i+" "+ city_count+" " + criminals);
			if((city_count==2 && criminals==2) ||(city_count==1 && criminals==1)) {
				r=r+criminals;
			}
			criminals=0;
			city_count=0;
		}
		System.out.println(r);
	}

	public static void gardenRain() {
		Scanner sc= new Scanner(System.in);
		int n= sc.nextInt();
//		System.out.println(n);
		int [] levels = new int[n];
		int i_reached = 1;
		int left = 0;
		int right = 0;
		int mid = 0;
		int max = 1;
		boolean left_flag = true;
		levels[0]=sc.nextInt();
		for(int i =1;i<n;i++) {
//			System.out.println(i);
			if (i_reached==i) {
				levels[i]=sc.nextInt();
//				System.out.println(levels[i]);
				i_reached++;
			}

			if (left_flag) {
				if(levels[i]>=levels[i-1]) {
					left++;
//					System.out.println(levels[i]+" left");
				}
				else {
					left_flag = false;
					mid = i;
//					continue;
				}
			}
			if (!left_flag)
			{
				if(levels[i]<=levels[i-1]) {
					right++;
//					System.out.println(levels[i]+" right");
				}

				else {
					max = Math.max(left+right+1, max);
					left_flag=true;
					left=0;
					right=0;
					i = mid;
				}

			}
			max = Math.max(left+right+1, max);

		}
		System.out.println(max);
	}

	public static void vanye() {
		Scanner sc= new Scanner(System.in);
		String input1= sc.nextLine();
		String input2= sc.nextLine();
		String [] inputs1 = input1.split(" ");
		String [] inputs2 = input2.split(" ");
		int [] friends = new int[inputs2.length];
		for(int i=0;i<inputs2.length;i++) {
			friends[i] =Integer.parseInt(inputs2[i]);
		}
		int h = Integer.parseInt(inputs1[1]);
		int r = 0;
		for(int i = 0;i<friends.length;i++) {
			if(friends[i]<=h) {
				r++;
			}
			else {
				r+=2;
			}
		}
		System.out.println(r);

	}

	}


import java.util.*;
public class interview {
	public static void main(String[] args) {
		spell();
		}

	public static void spell() {
		Scanner sc= new Scanner(System.in);
		String n= sc.nextLine();
		long r = 0;
		int c = 0;
		String s = n+"";
//		System.out.println(s);
		while (n.length()>1) {
			s = n+"";
//			System.out.println(s);

			for (int i =s.length()-1;i>=0;i--) {
				c += Integer.parseInt(n.charAt(i)+"");
//				System.out.println((int)(n / Math.pow(10, i)));
//				System.out.println((int) (n % Math.pow(10, i)));
//				n = n.substring(1);

			}
//			System.out.println("c "+c);
			r++;
			n=c+"";
			c=0;
//			break;
			}

		System.out.println(r);

		}

	public static void pylon() {
		Scanner sc= new Scanner(System.in);
		int n= sc.nextInt();
		int max = 0;
		for(int i=0;i<n;i++) {
			max = Math.max(max, sc.nextInt());
		}
		System.out.println(max);
	}

	public static void bearPolice() {
		Scanner sc= new Scanner(System.in);
		int n= sc.nextInt();
		int a= sc.nextInt();
		a=a-1;
		int [] cities = new int[n];
		int criminals =0;
		int r =0;
		int city_count=0;
		for (int i = 0;i<n;i++) {
		cities[i]=sc.nextInt();
		}
		for(int i=0; (a+i<n)||(a-i>=0);i++) {
//			System.out.println(i);
			if(i==0 && cities[a]==1) {
//				criminals++;
				r++;
				continue;
			}
			if(a+i<n) {
					city_count++;
					if(cities[a+i]==1) {
						criminals++;
					}
				}

			if(a-i>=0) {
				city_count++;
				if(cities[a-i]==1) {
					criminals++;
				}
			}

//			System.out.println(a+" "+i+" "+ city_count+" " + criminals);
			if((city_count==2 && criminals==2) ||(city_count==1 && criminals==1)) {
				r=r+criminals;
			}
			criminals=0;
			city_count=0;
		}
		System.out.println(r);
	}

	public static void gardenRain() {
		Scanner sc= new Scanner(System.in);
		int n= sc.nextInt();
//		System.out.println(n);
		int [] levels = new int[n];
		int i_reached = 1;
		int left = 0;
		int right = 0;
		int mid = 0;
		int max = 1;
		boolean left_flag = true;
		levels[0]=sc.nextInt();
		for(int i =1;i<n;i++) {
//			System.out.println(i);
			if (i_reached==i) {
				levels[i]=sc.nextInt();
//				System.out.println(levels[i]);
				i_reached++;
			}

			if (left_flag) {
				if(levels[i]>=levels[i-1]) {
					left++;
//					System.out.println(levels[i]+" left");
				}
				else {
					left_flag = false;
					mid = i;
//					continue;
				}
			}
			if (!left_flag)
			{
				if(levels[i]<=levels[i-1]) {
					right++;
//					System.out.println(levels[i]+" right");
				}

				else {
					max = Math.max(left+right+1, max);
					left_flag=true;
					left=0;
					right=0;
					i = mid;
				}

			}
			max = Math.max(left+right+1, max);

		}
		System.out.println(max);
	}

	public static void vanye() {
		Scanner sc= new Scanner(System.in);
		String input1= sc.nextLine();
		String input2= sc.nextLine();
		String [] inputs1 = input1.split(" ");
		String [] inputs2 = input2.split(" ");
		int [] friends = new int[inputs2.length];
		for(int i=0;i<inputs2.length;i++) {
			friends[i] =Integer.parseInt(inputs2[i]);
		}
		int h = Integer.parseInt(inputs1[1]);
		int r = 0;
		for(int i = 0;i<friends.length;i++) {
			if(friends[i]<=h) {
				r++;
			}
			else {
				r+=2;
			}
		}
		System.out.println(r);

	}

	}


import java.util.*;
public class interview {
	public static void main(String[] args) {
		spell();
		}

	public static void spell() {
		Scanner sc= new Scanner(System.in);
		long n= sc.nextLong();
		long r = 0;
		long c = 0;
		String s = n+"";
//		System.out.println(s);
		while (n>=10) {
			s = n+"";
//			System.out.println(s);

			for (int i =s.length()-1;i>=0;i--) {
				c += (long) (n / Math.pow(10, i));
//				System.out.println((int)(n / Math.pow(10, i)));
//				System.out.println((int) (n % Math.pow(10, i)));
				n = (long) (n % Math.pow(10, i));

			}
//			System.out.println("c "+c);
			r++;
			n=c;
			c=0;
//			break;
			}

		System.out.println(r);

		}

	public static void pylon() {
		Scanner sc= new Scanner(System.in);
		int n= sc.nextInt();
		int max = 0;
		for(int i=0;i<n;i++) {
			max = Math.max(max, sc.nextInt());
		}
		System.out.println(max);
	}

	public static void bearPolice() {
		Scanner sc= new Scanner(System.in);
		int n= sc.nextInt();
		int a= sc.nextInt();
		a=a-1;
		int [] cities = new int[n];
		int criminals =0;
		int r =0;
		int city_count=0;
		for (int i = 0;i<n;i++) {
		cities[i]=sc.nextInt();
		}
		for(int i=0; (a+i<n)||(a-i>=0);i++) {
//			System.out.println(i);
			if(i==0 && cities[a]==1) {
//				criminals++;
				r++;
				continue;
			}
			if(a+i<n) {
					city_count++;
					if(cities[a+i]==1) {
						criminals++;
					}
				}

			if(a-i>=0) {
				city_count++;
				if(cities[a-i]==1) {
					criminals++;
				}
			}

//			System.out.println(a+" "+i+" "+ city_count+" " + criminals);
			if((city_count==2 && criminals==2) ||(city_count==1 && criminals==1)) {
				r=r+criminals;
			}
			criminals=0;
			city_count=0;
		}
		System.out.println(r);
	}

	public static void gardenRain() {
		Scanner sc= new Scanner(System.in);
		int n= sc.nextInt();
//		System.out.println(n);
		int [] levels = new int[n];
		int i_reached = 1;
		int left = 0;
		int right = 0;
		int mid = 0;
		int max = 1;
		boolean left_flag = true;
		levels[0]=sc.nextInt();
		for(int i =1;i<n;i++) {
//			System.out.println(i);
			if (i_reached==i) {
				levels[i]=sc.nextInt();
//				System.out.println(levels[i]);
				i_reached++;
			}

			if (left_flag) {
				if(levels[i]>=levels[i-1]) {
					left++;
//					System.out.println(levels[i]+" left");
				}
				else {
					left_flag = false;
					mid = i;
//					continue;
				}
			}
			if (!left_flag)
			{
				if(levels[i]<=levels[i-1]) {
					right++;
//					System.out.println(levels[i]+" right");
				}

				else {
					max = Math.max(left+right+1, max);
					left_flag=true;
					left=0;
					right=0;
					i = mid;
				}

			}
			max = Math.max(left+right+1, max);

		}
		System.out.println(max);
	}

	public static void vanye() {
		Scanner sc= new Scanner(System.in);
		String input1= sc.nextLine();
		String input2= sc.nextLine();
		String [] inputs1 = input1.split(" ");
		String [] inputs2 = input2.split(" ");
		int [] friends = new int[inputs2.length];
		for(int i=0;i<inputs2.length;i++) {
			friends[i] =Integer.parseInt(inputs2[i]);
		}
		int h = Integer.parseInt(inputs1[1]);
		int r = 0;
		for(int i = 0;i<friends.length;i++) {
			if(friends[i]<=h) {
				r++;
			}
			else {
				r+=2;
			}
		}
		System.out.println(r);

	}

	}


import java.util.*;
public class interview {
	public static void main(String[] args) {
		spell();
		}

	public static void spell() {
		Scanner sc= new Scanner(System.in);
		String n= sc.nextLine();
		long r = 0;
		int c = 0;
		String s = n+"";
//		System.out.println(s);
		while (n.length()>1) {
			s = n+"";
//			System.out.println(s);

			for (int i =s.length()-1;i>=0;i--) {
				c += Integer.parseInt(n.charAt(0)+"");
//				System.out.println((int)(n / Math.pow(10, i)));
//				System.out.println((int) (n % Math.pow(10, i)));
				n = n.substring(1);

			}
//			System.out.println("c "+c);
			r++;
			n=c+"";
			c=0;
//			break;
			}

		System.out.println(r);

		}

	public static void pylon() {
		Scanner sc= new Scanner(System.in);
		int n= sc.nextInt();
		int max = 0;
		for(int i=0;i<n;i++) {
			max = Math.max(max, sc.nextInt());
		}
		System.out.println(max);
	}

	public static void bearPolice() {
		Scanner sc= new Scanner(System.in);
		int n= sc.nextInt();
		int a= sc.nextInt();
		a=a-1;
		int [] cities = new int[n];
		int criminals =0;
		int r =0;
		int city_count=0;
		for (int i = 0;i<n;i++) {
		cities[i]=sc.nextInt();
		}
		for(int i=0; (a+i<n)||(a-i>=0);i++) {
//			System.out.println(i);
			if(i==0 && cities[a]==1) {
//				criminals++;
				r++;
				continue;
			}
			if(a+i<n) {
					city_count++;
					if(cities[a+i]==1) {
						criminals++;
					}
				}

			if(a-i>=0) {
				city_count++;
				if(cities[a-i]==1) {
					criminals++;
				}
			}

//			System.out.println(a+" "+i+" "+ city_count+" " + criminals);
			if((city_count==2 && criminals==2) ||(city_count==1 && criminals==1)) {
				r=r+criminals;
			}
			criminals=0;
			city_count=0;
		}
		System.out.println(r);
	}

	public static void gardenRain() {
		Scanner sc= new Scanner(System.in);
		int n= sc.nextInt();
//		System.out.println(n);
		int [] levels = new int[n];
		int i_reached = 1;
		int left = 0;
		int right = 0;
		int mid = 0;
		int max = 1;
		boolean left_flag = true;
		levels[0]=sc.nextInt();
		for(int i =1;i<n;i++) {
//			System.out.println(i);
			if (i_reached==i) {
				levels[i]=sc.nextInt();
//				System.out.println(levels[i]);
				i_reached++;
			}

			if (left_flag) {
				if(levels[i]>=levels[i-1]) {
					left++;
//					System.out.println(levels[i]+" left");
				}
				else {
					left_flag = false;
					mid = i;
//					continue;
				}
			}
			if (!left_flag)
			{
				if(levels[i]<=levels[i-1]) {
					right++;
//					System.out.println(levels[i]+" right");
				}

				else {
					max = Math.max(left+right+1, max);
					left_flag=true;
					left=0;
					right=0;
					i = mid;
				}

			}
			max = Math.max(left+right+1, max);

		}
		System.out.println(max);
	}

	public static void vanye() {
		Scanner sc= new Scanner(System.in);
		String input1= sc.nextLine();
		String input2= sc.nextLine();
		String [] inputs1 = input1.split(" ");
		String [] inputs2 = input2.split(" ");
		int [] friends = new int[inputs2.length];
		for(int i=0;i<inputs2.length;i++) {
			friends[i] =Integer.parseInt(inputs2[i]);
		}
		int h = Integer.parseInt(inputs1[1]);
		int r = 0;
		for(int i = 0;i<friends.length;i++) {
			if(friends[i]<=h) {
				r++;
			}
			else {
				r+=2;
			}
		}
		System.out.println(r);

	}

	}


import java.util.Scanner;

public class HarryPoterSpells {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long n = sc.nextInt();
        int nbCasts=0;
        while(n>=10){
            nbCasts++;
            long sum=0;
            for(int i=0;i<Long.toString(n).length();i++){
                sum+=Character.getNumericValue(Long.toString(n).charAt(i));
            }
            n=sum;
        }
        System.out.println(nbCasts);
    }
}


import java.util.Scanner;

public class HarryPoterSpells {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long n = sc.nextInt();
        int nbCasts=0;
        while(n>=10){
            nbCasts++;
            long sum=0;
            String ch = Long.toString(n);
            for(int i=0;i<ch.length();i++){
                sum+=Character.getNumericValue(ch.charAt(i));
            }
            n=sum;
        }
        System.out.println(nbCasts);
    }
}


import java.util.Scanner;

public class HarryPoterSpells {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long n = sc.nextInt();
        int nbCasts=0;
        while(n>=10){
            nbCasts++;
            long transformedNumber = n;
            long sum=0;
            int i=0;
            while(n>0){
                i++;
                sum+=n%10;
                transformedNumber=n/10;
                n=transformedNumber;
            }
            n=sum;
        }
        System.out.println(nbCasts);
    }
}


import java.util.Scanner;

public class HarryPoterSpells {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int nbCasts=0;
        while(n>=10){
            nbCasts++;
            int sum=0;
            String ch = Integer.toString(n);
            for(int i=0;i<ch.length();i++){
                sum+=Character.getNumericValue(ch.charAt(i));
            }
            n=sum;
        }
        System.out.println(nbCasts);
    }
}


import java.util.Scanner;

public class HarryPoterSpells {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String n = sc.nextLine();
        int nbCasts=0;
        while(Integer.valueOf(n)>=10){
            nbCasts++;
            long sum=0;
            for(int i=0;i<n.length();i++){
                sum+=Character.getNumericValue(n.charAt(i));
            }
            n=String.valueOf(sum);
        }
        System.out.println(nbCasts);
    }
}


import java.util.Scanner;

public class HarryPoterSpells {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String n = sc.nextLine();
        int nbCasts=0;
        while(n.length()>=2){
            nbCasts++;
            long sum=0;
            for(int i=0;i<n.length();i++){
                sum+=Character.getNumericValue(n.charAt(i));
            }
            n=String.valueOf(sum);
        }
        System.out.println(nbCasts);
    }
}


import java.util.Scanner;

public class HarryPoterSpells {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long n;
        do {
             n = sc.nextInt();
        }while((n<0)||(n>Math.pow(10,100000)));
        int nbCasts=0;
        while(n>=10){
            nbCasts++;
            long transformedNumber = n;
            long sum=0;
            int i=0;
            while(n>0){
                i++;
                sum+=n%10;
                transformedNumber=n/10;
                n=transformedNumber;
            }
            n=sum;
        }
        System.out.println(nbCasts);
    }
}


import java.util.Scanner;

public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String s = sc.nextLine();

    if(s.length() < 2){
      System.out.println(0);
      return;
    }
    int ans = 0;
    while(s.length() != 1){
      long sum = 0;
      for(int i=0; i<s.length(); ++i)
        sum += s.charAt(i) - '0';
      s = Long.toString(sum);
      ans++;
    }
    System.out.println(ans);
  }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) {
        FastScanner fs = new FastScanner();
        long n = fs.nextLong();
        int ans = 0;
        while(n >= 10){
            long sum = 0;
            long temp = n;
            while(temp != 0){
                sum += temp % 10;
                temp /= 10;
            }
            n = sum;
            ans++;
        }
        System.out.println(ans);
    }

    static class FastScanner {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer("");

        String next() {
            while (!st.hasMoreTokens())
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        int[] readArray(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++) a[i] = nextInt();
            return a;
        }

        long nextLong() {
            return Long.parseLong(next());
        }
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) {
        FastScanner fs = new FastScanner();
        String s = fs.next();
        BigInteger N = new BigInteger(s);
        int ans = 0;
        while(N.compareTo(BigInteger.TEN) >= 0){
            BigInteger sum = new BigInteger("0");
            BigInteger temp = new BigInteger(N.toString());
            while(!temp.equals(BigInteger.ZERO)){
                BigInteger last = temp.mod(BigInteger.TEN);
                sum = sum.add(last);
                temp = temp.divide(BigInteger.TEN);
            }
            N = sum;
            ans++;
        }
        System.out.println(ans);
    }

    static class FastScanner {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer("");

        String next() {
            while (!st.hasMoreTokens())
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        int[] readArray(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++) a[i] = nextInt();
            return a;
        }

        long nextLong() {
            return Long.parseLong(next());
        }
    }
}


import java.util.*;

public class MySolution
{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        String s = sc.nextLine();

        System.out.println(find(s, 0));

    }

    public static int find(String n, int transf)
    {
        if (n.length() == 1)
        {
            return transf;
        }

        int t = n.length();
        if (n.length() == 2 && Integer.parseInt(n) <= 18)
            t = 1;

        return find(String.valueOf(t * 9), transf + 1);
    }
}


import java.util.*;

public class MySolution
{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        String s = sc.nextLine();

        if (s.length() == 1)
        {
            System.out.println(0);
            return;
        }

        long sum = 0;
        for (int i = 0; i < s.length(); i++)
        {
            sum += Integer.parseInt(String.valueOf(s.charAt(i)));
        }

        System.out.println(find(sum, 1));

    }

    public static int find(long num, int transf)
    {
        if (num / 10 == 0)
        {
            return transf;
        }

        int sum = 0;
        while (num / 10 != 0)
        {
            sum += num % 10;
            num = num / 10;
        }
        sum += num;
        return find(sum, transf + 1);
    }
}


import java.util.*;

public class MySolution
{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int s = sc.nextInt();
        sc.nextLine();

        System.out.println(find(s, 0));

    }

    public static int find(int num, int transf)
    {
        if (num / 10 == 0)
        {
           return transf;
        }

        int sum = 0;
        while (num / 10 != 0)
        {
            sum += num % 10;
            num = num / 10;
        }
        sum += num;
        return find(sum, transf + 1);
    }
}


import java.util.Scanner;
public class SumOfDigits {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int t=sc.nextInt();
        int n=t;
        int s=0;
        int x=0;

        while(t>=10)
        {

            while(n!=0)
            {
                t=n%10;
                s=s+t;
                n=n/10;
            }

            t=s;
            n=t;
            s=0;
            x++;
        }
        System.out.println(x);
    }
}


import java.util.Scanner;
public class SumOfDigits {

    static int f1(String s)
    {
        if(s.length()==1)
       return 0;
        int a=0;
         for(int i=0;i<s.length();i++)
            {
                a=a+s.charAt(i)-'0';
                //System.out.println(s.charAt(i));
                System.out.println(a);
            }
         s="";
         s=s+a;
         if(s.length()==1)
             return 1;
         else
        return 1 + f1 ( s ) ;

    }
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);

        String s=sc.next();
        int t=f1(s);
        System.out.println(t);

        /*
        long t=sc.nextInt();
        long n=t;
        long s=0;
        long x=0;

        while(t>=10)
        {

            while(n!=0)
            {
                t=n%10;
                s=s+t;
                n=n/10;
            }

            t=s;
            n=t;
            s=0;
            x++;
        }
        System.out.println(x);
*/
    }
}


import java.util.Scanner;
public class SumOfDigits {

    static int f1(String s)
    {
        if(s.length()==1)
       return 0;
        int a=0;
         for(int i=0;i<s.length();i++)
            {
                a=a+s.charAt(i)-'0';
                //System.out.println(s.charAt(i));
                //System.out.println(a);
            }
         s="";
         s=s+a;
         if(s.length()==1)
             return 1;
         else
        return 1 + f1 ( s ) ;

    }
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);

        String s=sc.next();
        int t=f1(s);
        System.out.println(t);

        /*
        long t=sc.nextInt();
        long n=t;
        long s=0;
        long x=0;

        while(t>=10)
        {

            while(n!=0)
            {
                t=n%10;
                s=s+t;
                n=n/10;
            }

            t=s;
            n=t;
            s=0;
            x++;
        }
        System.out.println(x);
*/
    }
}


import java.math.BigInteger;
import java.util.Scanner;
public class Main {
    static BigInteger counter = new BigInteger("0");
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        String r  = s.nextLine();
        BigInteger a1 = new BigInteger(r);
        BigInteger b1 = new BigInteger("0");
        moduluss(a1);
        System.out.println(counter);

    }
    public static BigInteger moduluss(BigInteger a){
        BigInteger d = new BigInteger("10");
        BigInteger f = new BigInteger("1");

        while(a.compareTo(f) == 1){
            a = a.divide(d);
            counter=counter.add(f);
        }
        return counter;

    }
}


import java.math.BigInteger;
import java.util.Scanner;
public class Main {
    static BigInteger counter = new BigInteger("1");
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        String r  = s.nextLine();
        BigInteger a1 = new BigInteger(r);
        BigInteger b1 = new BigInteger("0");
        if(a1.compareTo(b1)==0){
            System.out.println(0);
        }
        else {
            moduluss(a1);
            System.out.println(counter);
        }
    }
    public static BigInteger moduluss(BigInteger a){
        BigInteger b = new BigInteger("0");
        BigInteger d = new BigInteger("10");
        BigInteger f = new BigInteger("1");
        BigInteger c = new BigInteger("0");
        BigInteger e =new BigInteger("0");
        while(a.compareTo(b) == 1){
            c = a.mod(d);
            a = a.divide(d);
            e = e.add(c);

        }
        if(e.compareTo(d)==-1) {
            return e;
        }
        else{
            counter=counter.add(f);
            return moduluss(e);
        }
    }
}


import java.util.Scanner;
public class Main {
    static int count =1;
    public static void main(String[] args) {
        Scanner s =new Scanner(System.in);
        String a = s.nextLine();
        long su = 0;
        for(int i =0;i<a.length();i++){
            su += a.charAt(i) - '0';
        }
        if(a.length() ==1) {
            System.out.println(0);
        }
        else {
            while (su >= 10) {
                count++;
                su = ghgh(su);
            }
            System.out.println(count);
        }
    }
    public static long ghgh(long a){
        long sum =0;
        while(a>0){
            long d1 = a%10;
            a = a/10;
            sum += d1;
        }
        return sum;
    }
}


mport java.math.BigInteger;
import java.util.Scanner;
public class Main {
    static BigInteger counter = new BigInteger("0");
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        String r  = s.nextLine();
        BigInteger a1 = new BigInteger(r);
        counter = moduluss(a1);
        System.out.println(counter);
    }
    public static BigInteger moduluss(BigInteger a){
        BigInteger b = new BigInteger("0");
        BigInteger d = new BigInteger("10");
        BigInteger f = new BigInteger("1");
        BigInteger c = new BigInteger("0");
        BigInteger e =new BigInteger("0");
        while(a.compareTo(b) == 1){
            c = c.add(a.mod(d));
            a = a.divide(d);
            e = e.add(c);
        }
        if(e.compareTo(d)==-1) {
            return e;
        }
        else{
            return moduluss(e);
        }
    }
}


import java.math.BigInteger;
import java.util.Scanner;
public class Main {
    static BigInteger counter = new BigInteger("0");
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        String r  = s.nextLine();
        BigInteger a1 = new BigInteger(r);
        BigInteger b2 = new BigInteger("10");
        BigInteger a2 = new BigInteger("0");
        if(a1.mod(b2).equals(a2) && a1.compareTo(a2) != 0){
            System.out.println(1);
        }
        else {
            BigInteger b1 = new BigInteger("0");
            moduluss(a1);
            System.out.println(counter);
        }

    }
    public static BigInteger moduluss(BigInteger a){
        BigInteger d = new BigInteger("10");
        BigInteger f = new BigInteger("1");

        while(a.compareTo(f) == 1){
            a = a.divide(d);
            counter=counter.add(f);
        }
        return counter;

    }
}


import java.math.BigInteger;
import java.util.Scanner;
public class Main {
    static BigInteger counter = new BigInteger("0");
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        String r  = s.nextLine();
        BigInteger a1 = new BigInteger(r);
        BigInteger b2 = new BigInteger("10");
        BigInteger a2 = new BigInteger("0");
        if(a1.mod(b2).equals(a2)){
            System.out.println(1);
        }
        else {
            BigInteger b1 = new BigInteger("0");
            moduluss(a1);
            System.out.println(counter);
        }

    }
    public static BigInteger moduluss(BigInteger a){
        BigInteger d = new BigInteger("10");
        BigInteger f = new BigInteger("1");

        while(a.compareTo(f) == 1){
            a = a.divide(d);
            counter=counter.add(f);
        }
        return counter;

    }
}


import java.math.BigInteger;
import java.util.Scanner;
public class Main {
    static BigInteger counter = new BigInteger("0");
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        String r  = s.nextLine();
        BigInteger a1 = new BigInteger(r);
        counter = moduluss(a1);
        System.out.println(counter);
    }
    public static BigInteger moduluss(BigInteger a){
        BigInteger b = new BigInteger("0");
        BigInteger d = new BigInteger("10");
        BigInteger f = new BigInteger("1");
        BigInteger c = new BigInteger("0");
        BigInteger e =new BigInteger("0");
        while(a.compareTo(b) == 1){
            c = c.add(a.mod(d));
            a = a.divide(d);
            e = e.add(c);
        }
        if(e.compareTo(d)==-1) {
            return e;
        }
        else{
            return moduluss(e);
        }
    }
}


import java.util.Scanner;
import java.util.List;
import java.util.ArrayList;
import java.io.PrintWriter;

public class Main{
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    PrintWriter out = new PrintWriter(System.out);
      String str = sc.next();
      int count=0;
      while(str.length()>1)
      {

        int sum=0;
        for(int i=0;i<str.length();i++)
          sum += str.charAt(i)-'0';
        str = sum+"";
        count++;
      }
      out.println(count);
    out.flush();
  }
}


import java.util.Scanner;
import java.util.List;
import java.util.ArrayList;
import java.io.PrintWriter;

public class Main{
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    PrintWriter out = new PrintWriter(System.out);
      int n = sc.nextInt();
      out.println(digitSum(n));
    out.flush();
  }
  private static int digitSum(int n)
  {

    int cnt=0;
    while(n > 9)
    {
      cnt++;
        int temp = n;
        int r=0;
        while(temp!=0)
        {
          r +=temp%10;
          temp/=10;
        }
        n=r;
    }
    return cnt;
  }
}


import java.util.Scanner;
import java.util.List;
import java.util.ArrayList;
import java.io.PrintWriter;

public class Main{
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    PrintWriter out = new PrintWriter(System.out);
      long n = sc.nextLong();
      out.println(digitSum(n));
    out.flush();
  }
  private static long digitSum(long n)
  {

    long cnt=0;
    while(n > 9)
    {
      cnt++;
        long temp = n;
        long r=0;
        while(temp!=0)
        {
          r +=temp%10;
          temp/=10;
        }
        n=r;
    }
    return cnt;
  }
}


import java.util.Scanner;

public class SumOfDigits {

	public static void main(String[] args) {
		Scanner input = new Scanner(System.in) ;
		int n = input.nextInt() ;
		input.close();
		int cnt = 0 ;
		while(n > 9){
			cnt ++ ;
			int sum = 0 ;
			while(n != 0){
				sum += n % 10 ;
				n /= 10 ;
			}
			n = sum ;
		}
		System.out.println(cnt);
	}

}


import java.math.BigInteger;
import java.util.Scanner;

public class SumOfDigits {

	public static void main(String[] args) {
		Scanner input = new Scanner(System.in) ;
		String n = input.next() ;
		System.out.println(n.length());
		input.close();
		BigInteger i = new BigInteger(n) ;
		int cnt = 0 ;
		BigInteger ten = new BigInteger("10") ;
		while(i.compareTo(new BigInteger(9 + "")) > 0){
			cnt ++ ;
			BigInteger sum = new BigInteger("" +0) ;
			while(!i.equals(new BigInteger("0"))){
				sum = sum.add(i.mod(ten));
				i = i.divide(ten) ;
			}
			i = sum ;
		}
		System.out.println(cnt);
	}

}


import java.math.BigInteger;
import java.util.Scanner;

public class SumOfDigits {

	public static void main(String[] args) {
		Scanner input = new Scanner(System.in) ;
		String n = input.next() ;
		input.close();
		BigInteger i = new BigInteger(n) ;
		int cnt = 0 ;
		BigInteger ten = new BigInteger("10") ;
		while(i.compareTo(new BigInteger(9 + "")) > 0){
			cnt ++ ;
			BigInteger sum = new BigInteger("" +0) ;
			while(!i.equals(new BigInteger("0"))){
				sum = sum.add(i.mod(ten));
				i = i.divide(ten) ;
			}
			i = sum ;
		}
		System.out.println(cnt);
	}

}


import java.util.Scanner;
import java.util.regex.Pattern;

public class SumOfDigits {

	public static void main(String[] args) {
		Scanner input = new Scanner(System.in) ;
		String [] n = input.next(Pattern.compile("[0-9]*")).split("[\\s]*") ;
		input.close();
		int cnt = 0 ;
		if(n.length > 1){
			cnt ++ ;
			int sum = 0 ;
			for(int i = 0 ; i < n.length ; i++){
				sum += Integer.parseInt(n[i]) ;
			}
			int temp = sum ;
			while(temp > 9){
				cnt ++ ;
				sum = 0 ;
				while(temp != 0){
					sum += temp % 10 ;
					temp /= 10 ;
				}
				temp = sum ;
			}
		}
		System.out.println(cnt);
	}

}


import java.io.PrintWriter;
import java.util.Scanner;

public class Main {
    void solve(Scanner in, PrintWriter out) {
        String n = in.next();
        long count = 0;
        for (int i = 0; i < n.length(); i++) {
            count += Integer.parseInt(String.valueOf(n.charAt(i)));
        }
        if (n.length() < 2) {
            System.out.println(0);
        } else {
            System.out.println(1 + digitDegree(count));
        }
    }

    public long digitDegree(long n) {
        if (n % 10 == n) {
            return 0;
        }
        int count = 0;
        while (n > 0) {
            count += n % 10;
            n /= 10;
        }
        return 1 + digitDegree(count);
    }

    void run() {
        try (
                Scanner in = new Scanner(System.in);
                PrintWriter out = new PrintWriter(System.out)) {
            solve(in, out);
        }
    }

    public static void main(String args[]) {
        new Main().run();
    }
}


import java.io.PrintWriter;
import java.util.Scanner;

public class Main {
    void solve(Scanner in, PrintWriter out) {
        int n = in.nextInt();
        System.out.println(digitDegree(n));
    }
    public int digitDegree(int n) {
        if (n % 10 == n) {
            return 0;
        }
        int count = 0;
        while (n > 0) {
            count += n % 10;
            n /= 10;
        }
        return 1 + digitDegree(count);
    }

    void run() {
        try (
                Scanner in = new Scanner(System.in);
                PrintWriter out = new PrintWriter(System.out)) {
            solve(in, out);
        }
    }

    public static void main(String args[]) {
        new Main().run();
    }
}


import java.io.PrintWriter;
import java.util.Scanner;

public class Main {
    void solve(Scanner in, PrintWriter out) {
        long n = in.nextLong();
        System.out.println(digitDegree(n));
    }
    public long digitDegree(long n) {
        if (n % 10 == n) {
            return 0;
        }
        int count = 0;
        while (n > 0) {
            count += n % 10;
            n /= 10;
        }
        return 1 + digitDegree(count);
    }

    void run() {
        try (
                Scanner in = new Scanner(System.in);
                PrintWriter out = new PrintWriter(System.out)) {
            solve(in, out);
        }
    }

    public static void main(String args[]) {
        new Main().run();
    }
}


import java.io.PrintWriter;
import java.util.Scanner;

public class Main {
    void solve(Scanner in, PrintWriter out) {
        String n = in.next();
        long count = 0;
        for (int i = 0; i < n.length(); i++) {
            count += Integer.parseInt(String.valueOf(n.charAt(i)));
        }
        System.out.println(count!=0 ? 1 + digitDegree(count) : 0);
    }

    public long digitDegree(long n) {
        if (n % 10 == n) {
            return 0;
        }
        int count = 0;
        while (n > 0) {
            count += n % 10;
            n /= 10;
        }
        return 1 + digitDegree(count);
    }

    void run() {
        try (
                Scanner in = new Scanner(System.in);
                PrintWriter out = new PrintWriter(System.out)) {
            solve(in, out);
        }
    }

    public static void main(String args[]) {
        new Main().run();
    }
}


import java.util.Scanner;

public class testing {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int n = input.nextInt();
        input.close();
        int spellCounter = 0;

        while (n/10 != 0) {
            n = sumDigitsOf(n);
            spellCounter++;
        }

        System.out.println(spellCounter);
    }

    private static int sumDigitsOf(int n) {
        int sum = 0;
        while (n != 0) {
            sum += n % 10;
            n/=10;
        }

        return sum;
    }
}


import java.util.Scanner;

public class testing {
    public static void main(String[] args) {
        String numbers;
        Scanner input = new Scanner(System.in);
        numbers = input.next();

        int sum = 0;
        int spellCounter = 0;
        int n = numbers.length();
        while (n != 1) {
            spellCounter++;
            for (int i = 0; i < n; i++) {
                sum += Character.getNumericValue(numbers.charAt(i));
            }
            numbers = Integer.toString(sum);
            n = numbers.length();
            sum = 0;

        }

        System.out.println(spellCounter);

    }

}


package com.ash.test.desktop;

import java.util.Scanner;

public class testing {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        long n = input.nextInt();
        input.close();
        int spellCounter = 0;

        while (n/10 != 0) {
            n = sumDigitsOf(n);
            spellCounter++;
        }

        System.out.println(spellCounter);
    }

    private static long sumDigitsOf(long n) {
        long sum = 0;
        while (n != 0) {
            sum += n % 10;
            n/=10;
        }

        return sum;
    }
}


import java.util.Scanner;

public class testing {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        long n = input.nextInt();
        input.close();
        int spellCounter = 0;

        while (n/10 != 0) {
            n = sumDigitsOf(n);
            spellCounter++;
        }

        System.out.println(spellCounter);
    }

    private static long sumDigitsOf(long n) {
        long sum = 0;
        while (n != 0) {
            sum += n % 10;
            n/=10;
        }

        return sum;
    }
}


//SumofDigits
import java.io.*;
import java.util.*;
public class SumofDigits{
static int t;
static String str;
static int[] arr;
static long n;
static long sum(long x){
	long sum=0;
	while(x>0){
		long rem=x%10;
		sum+=rem;
		x/=10;
	}
	return sum;
}
static long solve(){
	long count=1;
	if(str.length()==1){
		return 0;
	}
	for(int i=0;i<str.length();i++){
		n+=Integer.parseInt(str.charAt(i)+"");
	}
	while(n>9){
		count++;
		n=sum(n);

	}
	return count;
}
public static void main(String[] args) throws IOException{
		// BufferedReader br = new BufferedReader(new
  //      FileReader("sampleinp.txt"));
    	BufferedReader br = new BufferedReader(
                             new InputStreamReader(System.in));
	 	StringBuilder ans=new StringBuilder();
	 	str=br.readLine();
	 	ans.append(solve()+"\n");
		System.out.println(ans.toString());

    }
}


//SumofDigits
import java.io.*;
import java.util.*;
public class SumofDigits{
static int t;
static int[] arr;
static long n;
static long sum(long x){
	long sum=0;
	while(x>0){
		long rem=x%10;
		sum+=rem;
		x/=10;
	}
	return sum;
}
static long solve(){
	long count=0;
	if(n==0){
		return 0;
	}

	while(n!=1){
		count++;
		n=sum(n);

	}
	return count;
}
public static void main(String[] args) throws IOException{
		// BufferedReader br = new BufferedReader(new
  //      FileReader("sampleinp.txt"));
    	BufferedReader br = new BufferedReader(
                             new InputStreamReader(System.in));
	 	StringBuilder ans=new StringBuilder();
	 	n=Long.parseLong(br.readLine());
	 	ans.append(solve()+"\n");
		System.out.println(ans.toString());

    }
}


//SumofDigits
import java.io.*;
import java.util.*;
public class SumofDigits{
static int t;
static int[] arr;
static long n;
static long sum(long x){
	long sum=0;
	while(x>0){
		long rem=x%10;
		sum+=rem;
		x/=10;
	}
	return sum;
}
static long solve(){
	long count=0;
	if(n==0){
		return 0;
	}

	while(true){
		if(n>=0&&n<=9){break;}
		count++;
		n=sum(n);

	}
	return count;
}
public static void main(String[] args) throws IOException{
		// BufferedReader br = new BufferedReader(new
  //      FileReader("sampleinp.txt"));
    	BufferedReader br = new BufferedReader(
                             new InputStreamReader(System.in));
	 	StringBuilder ans=new StringBuilder();
	 	n=Long.parseLong(br.readLine());
	 	ans.append(solve()+"\n");
		System.out.println(ans.toString());

    }
}


import java.util.Scanner;
public class Sum {
     static int cnt=0;
	public int number(int c) {
		int sum=0,n;
		while(c>0) {
			n=c%10;
			sum=sum+n;
			c=c/10;
		}
		cnt=cnt+1;
		return sum;

	}
	public static void main(String[]args) {

		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		Sum sa=new Sum();
		int s = n;
		while(s>9)
		if(s>0&&s<9) {
			System.out.println(s);

		}
		else {
			s=sa.number(s);
		}
		System.out.println(cnt);
	}

}


import java.util.Scanner;
public class Sum {
     static int cnt=0;
	public int number(int c) {
		int sum=0,n;
		while(c>0) {
			n=c%10;
			sum=sum+n;
			c=c/10;
		}
		cnt=cnt+1;
		return sum;

	}
	public static void main(String[]args) {

		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		Sum sa=new Sum();
		int s = n;
		while(s>9)
		if(s>0&&s<9) {
			System.out.println(s);

		}
		else {
			s=sa.number(s);
		}
		System.out.println(cnt);
		sc.close();
	}

}


package lab;
import java.util.Scanner;
public class Sum {
     static int cnt=0;
	public int number(int c) {
		int sum=0,n;
		while(c>0) {
			n=c%10;
			sum=sum+n;
			c=c/10;
		}
		cnt=cnt+1;
		return sum;

	}
	public static void main(String[]args) {

		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		Sum sa=new Sum();
		int s = n;
		while(s>9)
		if(s>0&&s<9) {
			System.out.println(s);

		}
		else {
			s=sa.number(s);
		}
		System.out.println(cnt);
		sc.close();
	}

}


import java.util.Scanner;
public class Sum {
   public static void main(String[] args)
	    {
	        Scanner input = new Scanner(System.in);
	        String s = input.next();
	        int count = 0;
	        while(true)
	        {
	            int tot = 0;
	            if(s.length() == 1)
	                break;
	            for(int i =0; i<s.length(); i++)
	                tot += s.charAt(i)-'0';
	            s = tot+"";
	            count++;
	        }
	        System.out.println(count);

	    }
	}


import java.util.Scanner;
public class Sum {
     static int cnt=0;
	public int number(int c) {
		int sum=0,n;
		while(c>0) {
			n=c%10;
			sum=sum+n;
			c=c/10;
		}

		cnt=cnt+1;
		return sum;

	}
	public static void main(String[]args) {

		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		Sum sa=new Sum();
		int s = sa.number(n);
		while(s>9)
		if(s>0&&s<9) {
			System.out.println(s);

		}
		else {
			s=sa.number(s);
		}
		System.out.println(cnt);
	}

}


import java.util.Scanner;

public class SumOfDigits {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String num = scanner.nextLine();
        long ans = 0;

        while (Long.parseLong(num) >= 10) {
            long sum = 0;
            for (int i = 0; i < num.length(); i++) {
                sum += (num.charAt(i) - '0');
            }
            num = String.valueOf(sum);
            ans++;
        }

        System.out.println(ans);
    }

}


import java.util.Scanner;

public class SumOfDigits {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String num = scanner.nextLine();
        long ans = 0;

        while (num.length() > 1) {
            long sum = 0;
            for (int i = 0; i < num.length(); i++) {
                sum += (num.charAt(i) - '0');
            }
            num = String.valueOf(sum);
            ans++;
        }

        System.out.println(ans);
    }

}


import java.util.Scanner;

public class SumOfDigits {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        long num = scanner.nextLong();
        int ans = 0;

        while (num >= 10) {
            int sum = 0;
            while (num != 0) {
                sum += (num % 10);
                num /= 10;
            }
            num = sum;
            ans++;
        }

        System.out.println(ans);
    }

}


import java.util.Scanner;

public class SumOfDigits {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        long num = scanner.nextLong();
        long ans = 0;

        while (num >= 10) {
            long sum = 0;
            while (num != 0) {
                sum += (num % 10);
                num /= 10;
            }
            num = sum;
            ans++;
        }

        System.out.println(ans);
    }

}


import java.math.BigInteger;
import java.util.Scanner;

public class B102 {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int counter=0;
        BigInteger number = new BigInteger(s.next());
        while(number.toString().length()>1)
        {
            counter++;
            number = sumDig(number);
            // System.out.println(num); // check
        }
        System.out.println(counter);
    }

    private static BigInteger sumDig(BigInteger num) {
        BigInteger sum = new BigInteger("0");
        while(num.compareTo(BigInteger.ZERO)>0)
        {
            sum = sum.add(num.mod(BigInteger.TEN));
            num = num.divide(BigInteger.TEN);
        }
        return sum;
    }
}


import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;

public class B102 {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);

        long counter=0;
        long[] digCounter = new long[10]; // 0 to 9
        String numStr = s.next();

        long totalDigits = numStr.length();
        countDigits(numStr,digCounter);

        while (totalDigits>1)
        {
//            System.out.println(Arrays.toString(digCounter));
//            System.out.println("total: "+totalDigits);

            counter++;
            digCounter = doSomeMagic(digCounter);
            totalDigits = sumUpDigits(digCounter);

        }

        System.out.println(counter);
    }

    private static long sumUpDigits(long[] digCounter) {
        // sum all the counters and return it ! // simple ! //
        long total = 0;
        for (int i = 0; i < digCounter.length; i++) {
            total += digCounter[i];
        }
        return total;
    }

    private static long[] doSomeMagic(long[] digCounter) {
        // do the sum
        long sum=0;
        for (int i = 0; i < digCounter.length; i++) {
            sum += i*digCounter[i];
        }

        digCounter = new long[10];
        countDigits(sum+"",digCounter);
        return digCounter;
    }

    private static void countDigits(String num, long[] dCounter)
    {
        for (int i = 0; i < num.length(); i++) {
            dCounter[num.charAt(i)-'0']++;
        }
    }
}


import java.util.Scanner;

public class B102 {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int counter=0;
        long num = s.nextLong();
        while((num+"").length()>1)
        {
            counter++;
            num = sumDig(num);
            // System.out.println(num); // check
        }
        System.out.println(counter);
    }

    private static long sumDig(long num) {
        long sum = 0;
        while(num>0)
        {
            sum+=num%10;
            num/=10;
        }
        return sum;
    }
}


import java.util.Scanner;

public class Codeforces102B {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String s = in.nextLine();
        long sum = 0;
        int kol = 1;
        if (s.length() == 1) {
            System.out.println(0);
        } else {
            for (int i = 0; i < s.length(); i++) {
                char c = s.charAt(i);
                int t = (int) c - '0';
                sum += t;
            }
            while (sum >= 10) {
                long cur = sum;
                sum = 0;
                kol++;
                while (cur != 0) {
                    sum += cur % 10;
                    cur /= 10;
                }
            }
            System.out.println(kol);
        }
    }
}


import java.util.Scanner;

public class Codeforces102B {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String s = in.nextLine();
        long sum = 0;
        int kol = 1;
        if (s.length() == 1) {
            System.out.println(0);
        } else {
            for (int i = 0; i < s.length(); i++) {
                char c = s.charAt(i);
                int t = (int) c - '0';
                sum += t;
                if (sum >= 10) {
                    kol++;
                    sum -= 10;
                }
                if (sum == 9) {
                    kol++;
                    sum = 0;
                }
            }
            System.out.println(kol);
        }
    }
}


import java.util.Scanner;

public class Codeforces102B {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String s = in.nextLine();
        long sum = 0;
        int kol = 1;
        if (s.length() == 1) {
            System.out.println(0);
        } else {
            for (int i = 0; i < s.length(); i++) {
                char c = s.charAt(i);
                int t = (int) c - '0';
                sum += t;
                if (sum % 19 == 0) {
                    kol += sum / 19 + 1;
                    sum = 0;
                } else {
                    if (sum == 10) {
                        kol++;
                        sum -= 10;
                    }
                }
            }
            if (sum > 10) {
                System.out.println(kol + 1);
            } else {
                System.out.println(kol);
            }
        }
    }
}


import java.util.Scanner;

public class test {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String line = sc.nextLine();

        System.out.println(compute(line));
    }

    private static int compute(String line) {
        if (line.length() <= 1) {
            return 0;
        }

        int sum = 0;
        for (char c : line.toCharArray()) {
            sum += c - '0';
        }

        line = "" + sum;
        if (line.length() == 1) {
            return 1;
        }

        return 1 + compute(line);
    }
}


import java.math.BigInteger;
import java.util.Scanner;

public class test {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        BigInteger num = new BigInteger(sc.nextLine());
        int res = 0;
        while (num.compareTo(BigInteger.valueOf(9)) > 0) {
            res++;
            BigInteger tmp = num;
            BigInteger sum = BigInteger.ZERO;
            while (tmp.compareTo(BigInteger.ZERO) > 0) {
                sum = sum.add(tmp.mod(BigInteger.TEN));
                tmp = tmp.divide(BigInteger.TEN);
            }

            num = sum;
        }

        System.out.println(res);
    }
}


import java.util.Scanner;

public class test {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int num = sc.nextInt();
        int res = 0;
        while (num > 9) {
            res++;
            int tmp = num;
            int sum = 0;
            while (tmp > 0) {
                sum += tmp % 10;
                tmp /= 10;
            }

            num = sum;
        }

        System.out.println(res);
    }
}


import java.util.Scanner;

public class Main {
 public static void main(String[] args) {
 	Scanner sc = new Scanner(System.in);
   	String num = sc.next();

   	int count = 0;
   	while(num.length() > 1) {
   		num = sumOfDigits(num);
   		count++;
	}

	 System.out.println(count);
 }

 private static String sumOfDigits(String num) {
 	int sum = 0;
 	for(int i=0;i<num.length();i++) {
 		sum += (num.charAt(i) - '0');
	}

	return ""+sum;
 }

}


import java.util.Scanner;

public class CFB102 {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		int count = 0;
		while (true) {
			int sum = 0;
			for (int i = 0; i < s.length(); i++) {
				String r = "" + s.charAt(i);
				sum += Integer.parseInt(r);
			}
			count++;
			s = "" + sum;
			if (s.length() == 1)
				break;
		}

		System.out.println(count);

	}
}


import java.util.Scanner;

public class CFB102 {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		int count = 0;
		while (s.length() != 1) {
			int sum = 0;
			for (int i = 0; i < s.length(); i++) {
				String r = "" + s.charAt(i);
				sum += Integer.parseInt(r);
			}

			s = "" + sum;
			count++;
		}

		System.out.println(count);

	}
}


import java.util.Scanner;

public class B102 {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		String len = "" + n;
		int size = len.length();
		int count = 0;
		int sum = 0;
		for (int i = 1; i <= size; i++) {
			if (sum <= 9 && i == size)
				break;
			sum += (int) (n / (Math.pow(10, size - i)));
			n = (int) (n % (Math.pow(10, size - i)));
			count++;

		}

		System.out.println(count);
	}
}


import java.util.Scanner;

public class B102 {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		String len = "" + n;
		int size = len.length();
		int count = 0;
		int sum = 0;
		if(n<=9)
			{
			System.out.println(0);
			return;
			}
		for (int i = 1; i <= size; i++) {
			if (sum <= 9 && i == size+1)
				break;
			sum += (int) (n / (Math.pow(10, size - i)));
			n = (int) (n % (Math.pow(10, size - i)));
			count++;

		}

		System.out.println(count);
	}
}


import java.util.Scanner;

public class B102 {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		String len = "" + n;
		int size = len.length();
		int count = 0;
		if (n <= 9) {
			System.out.println(0);
			return;
		}
		int nCpy = n;

		while (n > 9) {
			int sum = 0;
			for (int i = 1; i <= size; i++) {

				sum += (int) (nCpy / (Math.pow(10, size - i)));

				nCpy = (int) (nCpy % (Math.pow(10, size - i)));

			}
			n = sum;
			nCpy = n;
			count++;
		}
		System.out.println(count);
	}
}


import java.util.Scanner;

public class B102 {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		String len = "" + n;
		int size = len.length();
		int count = 0;
		int sum = 0;
		for (int i = 1; i <= size; i++) {
			if (sum <= 9 && i == size+1)
				break;
			sum += (int) (n / (Math.pow(10, size - i)));
			n = (int) (n % (Math.pow(10, size - i)));
			count++;

		}

		System.out.println(count);
	}
}


import java.util.Scanner;

public class task2 {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int sum = 0;
        int result = 0;
        while (true) {
            if (n<=9) break;
            for(int i = n; i != 0; i /= 10)
            {
                sum += (i % 10);
            }
            result++;
            if (sum>9) {
                n = sum;
                sum = 0;
            }
            else break;
        }
        System.out.println(result);
    }
}


import java.util.Scanner;

public class task2 {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int sum = 0;
        int result = 0;
        while (n > 9) {
            for (int i = n; i > 0; i /= 10) {
                sum += (i % 10);
            }
            result++;
            n = sum;
            sum = 0;
        }
        System.out.println(result);
    }
}


import java.util.Scanner;

public class task2 {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String str = scanner.nextLine();
        String[] split;
        int sum = 0;
        int result = 0;
        split = str.split("");
        while (split.length > 1) {
            for (String aSplit : split) {
                sum += Integer.parseInt(aSplit);
            }
            result++;
            split = Integer.toString(sum).split("");
            sum = 0;
        }
        System.out.println(result);
    }
}


import java.util.Scanner;

public class task2 {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int sum = 0;
        int result = 0;
        while (true) {
            if (n<=9) break;
            for(int i = n; i > 0; i /= 10)
            {
                sum += (i % 10);
            }
            result++;
            if (sum>9) {
                n = sum;
                sum = 0;
            }
            else break;
        }
        System.out.println(result);
    }
}


import java.util.Scanner;

public class task2 {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        long n = scanner.nextInt();
        long sum = 0;
        int result = 0;
        while (n > 9) {
            for (long i = n; i > 0; i /= 10) {
                sum += (i % 10);
            }
            result++;
            n = sum;
            sum = 0;
        }
        System.out.println(result);
    }
}


import java.util.Scanner;

public class task2 {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int sum = 0;
        int result = 0;
        try {int n = scanner.nextInt();
        while (n > 9) {
            for (int i = n; i > 0; i /= 10) {
                sum += (i % 10);
            }
            result++;
            n = sum;
            sum = 0;
        }
            System.out.println(result);
            } catch (Exception e) {
            System.out.println(0);
        }

    }
}


import java.util.Scanner;

public class JavaApplication3 {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
      String x = in.nextLine();

         long c=0;
       long sum=0;
       while(x.length()!=1){
           for (int i = 0; i < x.length(); i++) {
               sum+=x.charAt(i)-(int)'0';
           }
           ++c;
           x=sum+"" ;
           sum=0;
       }
        System.out.println(c);
    }
}


import java.util.Scanner;

public class JavaApplication3 {
    static int f[];
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
       int n = in.nextInt();
       String x=n+"";
         int sum=0;
         for (int i = 0; i < x.length(); i++) {
            sum+=x.charAt(i)-(int)'0';
        }
         x=sum+"";
        f = new int[10];
        for (int i = 0; i < x.length(); i++) {
         f[x.charAt(i)-(int)'0']++;
        }
        System.out.println(x.length()- f[0]);

    }
}


import java.util.Scanner;

public class JavaApplication3 {
    static int f[];
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
       int n = in.nextInt();
       String x=n+"";

        f = new int[10];int c=0;
        for (int i = 0; i < x.length(); i++) {
         f[x.charAt(i)-(int)'0']++;
        }
        System.out.println(x.length()- f[0]);

    }
}


import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String st = in.nextLine();
        int sum;
        int ans = 0;
        while(st.length() != 1){
        	sum = 0;
        	for(int i = 0; i < st.length(); i++){
        		sum += st.charAt(i) - '0';
        	}
        	st = String.valueOf(sum);
        	ans++;
        }
        System.out.println(ans);

    }
}


import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.StringTokenizer;

public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		Scanner in = new Main().new Scanner(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		Main solver = new Main();
		solver.solve(1, in, out);
		out.close();
	}

	public void solve(int testNumber, Scanner in, PrintWriter out) {
		String s = in.readLine();
		int input = sum(s);
		int count = 0;
		while(input >= 10) {
			input = process(input);
			count++;
		}
		out.println(count);
	}

	public int sum(String num) {
		int sum = 0;
		String s = num + "";
		for(char c : s.toCharArray())
			sum += c - '0';
		return sum;
	}

	public int process(int num) {
		int sum = 0;
		String s = num + "";
		for(char c : s.toCharArray())
			sum += c - '0';
		return sum;
	}

	class Scanner {
		BufferedReader br;
		StringTokenizer in;

		public Scanner(InputStream inputStream) {
			br = new BufferedReader(new InputStreamReader(inputStream));
		}

		public String next() {
			return hasMoreTokens() ? in.nextToken() : null;
		}

		public String readLine() {
			try {
				return br.readLine();
			} catch (Exception e) {
				e.printStackTrace();
				return null;
			}
		}

		boolean hasMoreTokens() {
			while (in == null || !in.hasMoreTokens()) {
				String s = readLine();
				if (s == null)
					return false;
				in = new StringTokenizer(s);
			}
			return true;
		}

		public String nextString() {
			return next();
		}

		public int nextInt() {
			return Integer.parseInt(nextString());
		}

		public int[] nextIntArray(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++) {
				a[i] = nextInt();
			}
			return a;
		}
	}
}


import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.StringTokenizer;

public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		Scanner in = new Main().new Scanner(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		Main solver = new Main();
		solver.solve(1, in, out);
		out.close();
	}

	public void solve(int testNumber, Scanner in, PrintWriter out) {
		int input = in.nextInt();
		int count = 0;
		while(input >= 10) {
			input = process(input);
			count++;
		}
		out.println(count);
	}

	public int process(int num) {
		int sum = 0;
		String s = num + "";
		for(char c : s.toCharArray())
			sum += c - '0';
		return sum;
	}

	class Scanner {
		BufferedReader br;
		StringTokenizer in;

		public Scanner(InputStream inputStream) {
			br = new BufferedReader(new InputStreamReader(inputStream));
		}

		public String next() {
			return hasMoreTokens() ? in.nextToken() : null;
		}

		public String readLine() {
			try {
				return br.readLine();
			} catch (Exception e) {
				e.printStackTrace();
				return null;
			}
		}

		boolean hasMoreTokens() {
			while (in == null || !in.hasMoreTokens()) {
				String s = readLine();
				if (s == null)
					return false;
				in = new StringTokenizer(s);
			}
			return true;
		}

		public String nextString() {
			return next();
		}

		public int nextInt() {
			return Integer.parseInt(nextString());
		}

		public int[] nextIntArray(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++) {
				a[i] = nextInt();
			}
			return a;
		}
	}
}


import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.StringTokenizer;

public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		Scanner in = new Main().new Scanner(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		Main solver = new Main();
		solver.solve(1, in, out);
		out.close();
	}

	public void solve(int testNumber, Scanner in, PrintWriter out) {
		String s = in.readLine();
		int input = sum(s);
		int count = (s.length() <= 1) ? 0 : 1;
		while(input >= 10) {
			input = process(input);
			count++;
		}
		out.println(count);
	}

	public int sum(String num) {
		int sum = 0;
		String s = num + "";
		for(char c : s.toCharArray())
			sum += c - '0';
		return sum;
	}

	public int process(int num) {
		int sum = 0;
		String s = num + "";
		for(char c : s.toCharArray())
			sum += c - '0';
		return sum;
	}

	class Scanner {
		BufferedReader br;
		StringTokenizer in;

		public Scanner(InputStream inputStream) {
			br = new BufferedReader(new InputStreamReader(inputStream));
		}

		public String next() {
			return hasMoreTokens() ? in.nextToken() : null;
		}

		public String readLine() {
			try {
				return br.readLine();
			} catch (Exception e) {
				e.printStackTrace();
				return null;
			}
		}

		boolean hasMoreTokens() {
			while (in == null || !in.hasMoreTokens()) {
				String s = readLine();
				if (s == null)
					return false;
				in = new StringTokenizer(s);
			}
			return true;
		}

		public String nextString() {
			return next();
		}

		public int nextInt() {
			return Integer.parseInt(nextString());
		}

		public int[] nextIntArray(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++) {
				a[i] = nextInt();
			}
			return a;
		}
	}
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;

public class SumDig {
	public static BigInteger castSpell(BigInteger x) {
		BigInteger out=new BigInteger("0");
		while(x.compareTo(new BigInteger("0"))>0) {
			out=out.add(x.mod(new BigInteger("10")));
			x=x.divide(new BigInteger("10"));
		}
		return out;
	}
public static void main(String[]args) throws IOException {
	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	PrintWriter out = new PrintWriter(System.out);
	BigInteger n=new BigInteger(br.readLine());
	BigInteger spells=new BigInteger("0");
	while(!n.divide(new BigInteger("10")).equals(new BigInteger("0"))) {
		n=castSpell(n);
		spells=spells.add(new BigInteger("1"));
	}
	out.println(spells);
	out.close();
}
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;

public class SumDig {
	public static BigInteger castSpell(BigInteger x) {
		BigInteger out=new BigInteger("0");
		while(x.compareTo(new BigInteger("0"))>0) {
			out=out.add(x.mod(new BigInteger("10")));
			x=x.divide(new BigInteger("10"));
		}
		return out;
	}
public static void main(String[]args) throws IOException {
	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	PrintWriter out = new PrintWriter(System.out);
	String s=br.readLine();
	int spells=0;
	while(s.length()>1) {
		int sum=0;
		for(int i=0;i<s.length();i++) {
			sum+=s.charAt(i)-'0';
		}
		s=""+sum;
		spells++;
	}
	out.println(spells);
	out.close();
}
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;

public class SumDig {
	public static BigInteger castSpell(BigInteger x) {
		BigInteger out=new BigInteger("0");
		while(x.compareTo(new BigInteger("0"))>0) {
			out=out.add(x.mod(new BigInteger("10")));
			x=x.divide(new BigInteger("10"));
		}
		return out;
	}
public static void main(String[]args) throws IOException {
	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	PrintWriter out = new PrintWriter(System.out);
	BigInteger n=new BigInteger(br.readLine());
	BigInteger spells=new BigInteger("0");
	while(n.intValue()/10!=0) {
		n=castSpell(n);
		spells=spells.add(new BigInteger("1"));
	}
	out.println(spells);
	out.close();
}
}


import java.util.*;
import java.io.*;
import java.lang.*;
import java.math.*;

public class B_102 implements Runnable{

    public void solve(){
        String s  = scan.next();
        char ar[] = s.toCharArray();
        long sum = 0;
        for(char c : ar){
            sum += Character.getNumericValue(c);
        }
        int count = 1;
        if(ar.length==1)
            out.println(0);
        else if(sum<10){
            out.print(1);
        }else{
        do{
            // System.out.println("sum : "+sum);
            long ss = sum;
            long p = 0;
            while(ss!=0){
                p+=ss%10;
                ss/=10;
            }
            sum = p;
            count++;
        }while(sum>=10);
        out.print(count);
        }
    }

    InputReader scan;
    PrintWriter out;

    @Override
    public void run(){
        scan = new InputReader(System.in);
        out = new PrintWriter(System.out);
        solve();
        out.flush();
        out.close();
    }

    public static void main(String[] args) {
        new Thread(null,new B_102(),"Main",1<<26).start();
    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private SpaceCharFilter filter;
        private BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars==-1)
                throw new InputMismatchException();

            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                }
                catch (IOException e) {
                    throw new InputMismatchException();
                }

                if(numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            }
            catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
        public int nextInt() {
            int c = read();

            while(isSpaceChar(c))
                c = read();

            int sgn = 1;

            if (c == '-') {
                sgn = -1;
                c = read();
            }

            int res = 0;
            do {
                if(c<'0'||c>'9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));

            return res * sgn;
        }

        public long nextLong() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;

            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));
                return res * sgn;
        }

        public double nextDouble() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            double res = 0;
            while (!isSpaceChar(c) && c != '.') {
                if (c == 'e' || c == 'E')
                    return res * Math.pow(10, nextInt());
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            if (c == '.') {
                c = read();
                double m = 1;
                while (!isSpaceChar(c)) {
                    if (c == 'e' || c == 'E')
                        return res * Math.pow(10, nextInt());
                    if (c < '0' || c > '9')
                        throw new InputMismatchException();
                    m /= 10;
                    res += (c - '0') * m;
                    c = read();
                }
            }
            return res * sgn;
        }

        public String readString() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            }
            while (!isSpaceChar(c));

            return res.toString();
        }

        public boolean isSpaceChar(int c) {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public String next() {
            return readString();
        }

        public long[] nla(int n){ //nextLongArray()
            long ar[] = new long[n];
            for(int i=0;i<n;i++){
                ar[i] = this.nextLong();
            }
            return ar;
        }

        public int[] nia(int n){
            int ar[] = new int[n];
            for(int i=0;i<n;i++){
                ar[i] = this.nextInt();
            }
            return ar;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);
        }
    }

}


import java.util.*;
import java.io.*;
import java.lang.*;
import java.math.*;

public class B_102 implements Runnable{

    public void solve(){
        String s  = scan.next();
        BigInteger b = new BigInteger(s);
        // int n = scan.nextInt();
        BigInteger bb = new BigInteger("10");
        long count = 0;
        while(!b.divide(bb).equals(BigInteger.ZERO)){
            // b = b.divide(bb);
            BigInteger k = b;
            long sum = 0;
            while(!k.equals(BigInteger.ZERO)){
                sum += k.divide(bb).longValue();
                k = k.divide(bb);
            }
            b = BigInteger.valueOf(sum);
            count++;
        }
        out.print(count);
    }

    InputReader scan;
    PrintWriter out;

    @Override
    public void run(){
        scan = new InputReader(System.in);
        out = new PrintWriter(System.out);
        solve();
        out.flush();
        out.close();
    }

    public static void main(String[] args) {
        new Thread(null,new B_102(),"Main",1<<26).start();
    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private SpaceCharFilter filter;
        private BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars==-1)
                throw new InputMismatchException();

            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                }
                catch (IOException e) {
                    throw new InputMismatchException();
                }

                if(numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            }
            catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
        public int nextInt() {
            int c = read();

            while(isSpaceChar(c))
                c = read();

            int sgn = 1;

            if (c == '-') {
                sgn = -1;
                c = read();
            }

            int res = 0;
            do {
                if(c<'0'||c>'9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));

            return res * sgn;
        }

        public long nextLong() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;

            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));
                return res * sgn;
        }

        public double nextDouble() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            double res = 0;
            while (!isSpaceChar(c) && c != '.') {
                if (c == 'e' || c == 'E')
                    return res * Math.pow(10, nextInt());
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            if (c == '.') {
                c = read();
                double m = 1;
                while (!isSpaceChar(c)) {
                    if (c == 'e' || c == 'E')
                        return res * Math.pow(10, nextInt());
                    if (c < '0' || c > '9')
                        throw new InputMismatchException();
                    m /= 10;
                    res += (c - '0') * m;
                    c = read();
                }
            }
            return res * sgn;
        }

        public String readString() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            }
            while (!isSpaceChar(c));

            return res.toString();
        }

        public boolean isSpaceChar(int c) {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public String next() {
            return readString();
        }

        public long[] nla(int n){ //nextLongArray()
            long ar[] = new long[n];
            for(int i=0;i<n;i++){
                ar[i] = this.nextLong();
            }
            return ar;
        }

        public int[] nia(int n){
            int ar[] = new int[n];
            for(int i=0;i<n;i++){
                ar[i] = this.nextInt();
            }
            return ar;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);
        }
    }

}