You can perform the following operations on a positive integer:
If the number is divisible by , divide it by ;
If the number is divisible by , divide it by ;
Subtract .
Given a positive integer , find the minimum number of operations required to obtain from .
Each line contains a single positive integer (1 \le n \le 10^6).
For each , print the minimum number of operations required to obtain on a separate line.
Example 1