Minimum Number Of Steps To Reduce N

easy
1. You are given a number N.
2. You have to find the minimum number of operations needed to reduce it to 1.
3. operations allowed are - 
   -> If n is divisible by 2 then you may reduce n to n/2.
   -> If n is divisible by 3 then you may reduce n to n/3.
   -> Decrement n by 1.

Input Format

A number N

Output Format

Check the sample output and question video.

Constraints

1 <= arr[i] <= 10^6

Example

Input
10
Output
3
Previous
Minimum Delta In Partitions
Next
Minimum Number Of Steps To Form N

Related Questions