SOLVE
LATER
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 $$p_i$$ (\(p\) is a permutation of numbers \(1 \ldots n\)). You have to reach position \(n\). Determine the minimum possible cost.
Input format
Output format
Print the minimum possible cost.
-