#include <iostream>
#include <cstring>
using namespace std;
char *
itoa (int number, char *destination, int base)
{
int count = 0;
do
{
int digit = number % base;
destination[count++] = (digit > 9) ? digit - 10 + 'A' : digit + '0';
}
while ((number /= base) != 0);
destination[count] = '\0';
int i;
for (i = 0; i < count / 2; ++i)
{
char symbol = destination[i];
destination[i] = destination[count - i - 1];
destination[count - i - 1] = symbol;
}
return destination;
}
int
f (char *str, int i)
{
if (i == 0)
return int (str[i]) - int ('0');
else
return (int (str[i]) - int ('0')) *f (str, i - 1);
}
int
main ()
{
char str[3000000];
int t;
while (cin >> str)
{
int count = 0;
while (strlen (str) > 1)
{
int k = strlen (str) - 1;
t = f (str, k);
memset (str, 0, sizeof (str) / sizeof (str[0]));
itoa (t, str, 10);
count++;
}
cout << count << endl;
}
return 0;
}