There is a stone bridge connecting India to Srilanka. First stone starting from India is having 1 inscribed on it, and last stone is on Srilankan side. Each subsequent stone has two consecutive numbers on it except the last stone which may have one or two numbers inscribed on it depending on value of N. Stones may be aligned as: 1, (2, 3), (4, 5), (6, 7)... N.
You are given a number N representing the last number on the last stone; and a number X. The task is to find the minimum number of jumps you need from either Indian side or Srilankan side to reach the stone that has X inscribed on it.
Note: Jumping on first stone will be counted as 0 jumps.
Input format:
Output format:
Explanation here N=10, and X=3. Stone alignment for N = 10 is as follows: 1, (2, 3), (4, 5), (6, 7), (8, 9), 10 To jump on X = 3, you only need one jump (since first stone jump will not be counted) from India side, and 4 jumps from Srilanka side. So the minimum of 1 and 4 is 1.