cho.sh
Notes
Loading...

Tournament Meeting Round

Time limit

1s

Memory limit

512 MB

Problem

There are N participants numbered from 1 to N. In each round, participants with adjacent numbers play each other: 1 with 2, 3 with 4, and so on. The winner advances to the next round, and the loser is eliminated. If a round has an odd number of participants, the participant with the largest number advances without playing.

Before the next round starts, the remaining participants are renumbered from 1. Their relative order from the previous numbering is preserved. In other words, a survivor who had a smaller previous number receives a smaller number in the next round.

Kim Jimin and Im Hansu are both assumed to win every match until they face each other. Given their numbers in round 1, find the round number in which they first play each other.

Input

The first line contains three space-separated integers: the number of participants N, Kim Jimin's round-1 number, and Im Hansu's round-1 number.

N is an integer between 2 and 100,000, inclusive. The two player numbers are distinct integers between 1 and N, inclusive.

Output

Print the round number in which Kim Jimin and Im Hansu first play each other. If they never play each other, print -1.