Help needed in Cognizant Genc Next Problem(14 Aug 2022)

There are n students in a class . Each student is represented by their index i. Two students want to exchange their lunch given the student can only exchange their lunch with i/2th student. We have to
tell in how many minimum steps the two students can exchange their lunch. In the process other students can also exchange their lunch.

Example
Input type
n–> no of students
i,j the index of student who want to exchange their lunch

output type
print the minimum step required

Example1
Input1
2
1 2

Output
1

Input 2
3
2 3

Output2
3

Explanation 1
2nd index student exchange with 1st student in one step.

Explanation 2
Original order is (1,2,3)
3rd exchange with 1 (3,2,1)
2nd exchange with 1 (3,1,2)
3rd exchange with 1 (1,3,2)
The required order is(1,3,2)