Handbags#1164

Handbags

1 second
64 megabytes
Medium

Katrusia is preparing for a trip to an olympiad in a distant European city. Naturally, she needs to bring bags with her. To avoid extra luggage fees, Katrusia has cleverly nested some bags inside others.

After gathering all bags she plans to take, Katrusia suddenly realizes that her favorite plush chipmunk might be in the wrong bag. Your task is to determine how many bags need to be opened to move it to the correct one.

Input

The first line of the input contains three integers , , and — representing the number of bags, the current bag number where the chipmunk is located, and the target bag number where it should be placed (1 \leq n \leq 100, 1 \leq a, b \leq n).

The second line contains numbers: for each bag, the number if it is not inside any other bag, or the number of the bag it is inside. A bag can only be inside a bag with a smaller number.

Bags are numbered starting from one. Initially, all of them are closed.

Output

Output a single integer — the number of bags that need to be opened.

Examples

Example 1

Loading
Loading