Given a natural number , its arithmetic derivative is defined as follows:
.
If is prime, then .
Let , with . Then .
For instance, , and . It can be proven that this definition is consistent. For example, , and also .
We say that is a fixed point of if . For instance, 0 and 4 are fixed points. Given and , can you compute the number of fixed points of in ?
Input consists of several cases, each one with and , with .
For each case, print the number of fixed points of in .
Input
0 4 1 20 4 4 5 23 900000000000000000 1000000000000000000
Output
2 1 1 0 0