#include <iostream>
#include <string>
using namespace std;
string f(string x) {
int mult = 1;
for (int i = 0; i < x.length(); i++) {
mult *= int(x.at(i)) - int('0');
}
string result = to_string(mult);
return result;
}
int main() {
string inp;
while (cin >> inp) {
int count = 0;
while (inp.length() > 1) {
inp = f(inp);
count++;
}
cout << count << endl;
}
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8c3RyaW5nPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKc3RyaW5nIGYoc3RyaW5nIHgpIHsKCWludCBtdWx0ID0gMTsKCWZvciAoaW50IGkgPSAwOyBpIDwgeC5sZW5ndGgoKTsgaSsrKSB7CgkJbXVsdCAqPSBpbnQoeC5hdChpKSkgLSBpbnQoJzAnKTsKCX0KCXN0cmluZyByZXN1bHQgPSB0b19zdHJpbmcobXVsdCk7CglyZXR1cm4gcmVzdWx0Owp9CgppbnQgbWFpbigpIHsKCXN0cmluZyBpbnA7Cgl3aGlsZSAoY2luID4+IGlucCkgewoJCWludCBjb3VudCA9IDA7CgkJd2hpbGUgKGlucC5sZW5ndGgoKSA+IDEpIHsKCQkJaW5wID0gZihpbnApOwoJCQljb3VudCsrOwoJCX0KCQljb3V0IDw8IGNvdW50IDw8IGVuZGw7Cgl9CglyZXR1cm4gMDsKfQ==