#include <iostream>
using namespace std;
int p(int x) {
int t = 1;
while (x != 0) {
t *= x % 10;
x = x / 10;
}
return t;
}
int main() {
int x;
while (cin >> x) {
int i = 0;
while (x / 10 != 0) {
x = p(x);
i++;
}
cout << i << endl;
}
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKaW50IHAoaW50IHgpIHsKIGludCB0ID0gMTsKIHdoaWxlICh4ICE9IDApIHsKICB0ICo9IHggJSAxMDsKICB4ID0geCAvIDEwOwogfQogcmV0dXJuIHQ7Cn0KCmludCBtYWluKCkgewogaW50IHg7CiB3aGlsZSAoY2luID4+IHgpIHsKICBpbnQgaSA9IDA7CiAgd2hpbGUgKHggLyAxMCAhPSAwKSB7CiAgIHggPSBwKHgpOwogICBpKys7CiAgfQogIGNvdXQgPDwgaSA8PCBlbmRsOwogfQogcmV0dXJuIDA7Cn0=