Time limit
0.15s
Memory limit
128 MB
For an integer X, you may use the following three operations.
Given an integer N, use these operations in any order to make N equal to 1. Find the minimum possible number of operations.
The first line contains an integer N. (1 <= N <= 1,000,000)
Print the minimum number of operations needed.
For N = 10, one optimal sequence is 10 -> 9 -> 3 -> 1, which uses 3 operations.