Problem 1 : Boss



Problem

An organization has a well-structured human resource. The Chief Executive Officer (CEO) is the top boss of the entire organization. He is the most important personnel and has no boss to report. All other personnel in the organization have a boss to report directly. A boss in turn has direct control over a number of subordinate personnel who are ordered according to their importance. A subordinate under the direct control of a boss may or may not be a boss.

All personnel including the CEO are ordered totally according to their importance in the organization. A personnel X is considered more important than another personnel Y if any of the following is true:

Let the organization has n personnel. A personnel is identified by a distinct integer 1,2, ... or n, called the ID of the personnel, according to the order of importance. The most important personnel viz., the CEO has ID equal to 1, while the least important personnel has ID equal to n.

A boss may communicate directly to a subordinate in 1(one) unit of communication time(UCT) while a subordinate requires 2 (two) UCT to communicate with the boss.

The organization maintains a list L of all personnel identified by their IDs. A boss appears in L only after all direct subordinates appear in order of their importance. Given L and two personnel X and Y, you are required to write a program that finds the time T in UCT for X to communicate a message to Y.

Input

The input consists of multiple test cases. Each test case contains data in two lines. The first line gives three integers n, X and Y defined above. The next line gives a sequence of n integers representing the list L. Fields in input are separated by a single space.

The input terminates when a line containing 0 appears.

Output

For each test case output the required time T as an integer.

Sample Input

7 2 4
2 6 7 4 5 3 1
7 4 2
2 6 7 4 5 3 1
0

Sample Output

4
5