Reduce N To 1
easy
1. You are given a positive number N. 2. You have to find the minimum number of operations required to convert N into 1. 3. Operations allowed : (i) If n is even, you have to replace n with n/2. (ii) If n is odd, you can replace n with either n-1 or n+1.
Constraints
1 <= N <= 2147483647
Format
Input
A number N
Output
Check the sample ouput and question video.
Example
Sample Input
8
Sample Output
3
Question Video