// Arup Guha
// 11/14/2015
// Solution to 2015 SER D2 Problem: Persistence

import java.util.*;

public class persistence {

	public static void main(String[] args) {

		// Read in input.
		Scanner stdin = new Scanner(System.in);
		int n = stdin.nextInt();

		// Simulate process.
		int res = 0;
		while (n > 9) {
			n = prodDigits(n);
			res++;
		}

		// Output result.
		System.out.println(res);
	}

	// Returns the product of the digits of n.
	public static int prodDigits(int n) {
		int res = 1;
		while (n > 0) {
			res *= (n%10);
			n /= 10;
		}
		return res;
	}
}