You are standing at position 1. From position i, you can walk to i+1 or i−1 with cost 1. From position i, you can travel to without any cost to pi (p is a permutation of numbers 1…n). You have to reach position n. Determine the minimum possible cost.
Input format
Output format
Print the minimum possible cost.
-