J. Magic with Cards
time limit per test
2 seconds
memory limit per test
512 megabytes
input
standard input
output
standard output

Mahsa has been practicing shuffling cards for a few months now. Tonight, she finally decided to invite her friends over and show off her new skills. So she picks up a deck with $$$2n$$$ cards, shows her friends the face of the cards without changing the deck order and asks someone to pick two positions i and j in the deck. Then,she tells everyone that she is going to move the card in the $$$i$$$-th position to the $$$j$$$-th position by applying only two types of shuffles.

Assume the cards in the deck are $$$\langle c_1, c_2, \dots, c_{2n} \rangle$$$. Mahsa can perform these two shuffles as many times as she wants:

Riffle: Divide the cards into two parts $$$\langle c_1, \dots, c_n \rangle$$$ and $$$\langle c_{n+1}, \dots, c_{2n} \rangle$$$ and produce $$$\langle c_1, c_{n+1}, c_2, c_{n+2}, \dots, c_{n}, c_{2n} \rangle$$$.

Scuffle: From $$$\langle c_1, c_2, \dots, c_{2n} \rangle$$$, produce $$$\langle c_2, c_1, c_4, c_3, \dots, c_{2n}, c_{2n-1} \rangle$$$.

Help Mahsa find out the minimum number of shuffles she needs, and she'll figure out the rest.

Input

The input consists of a single line containing three space-separated integers $$$n$$$, $$$i$$$ and $$$j$$$ ($$$1 \leq n \leq 10^{5}$$$ and $$$1 \leq i, j \leq 2n$$$)

Output

Print a single integer, the minimum number of shuffles required to bring the $$$i$$$-th card to $$$j$$$-th position. If it is not possible to do so, print -1 instead.

Examples
Input
4 3 8
Output
3
Input
5 4 1
Output
5
Input
1 1 1
Output
0