The river has stones placed and each stone has a maximum power associated with it which means if chetan lands on ith stone which has power then he can make another jump of length .Currently chetan is on left side of river and he has to cross the river with landing only on one stone . Print the minimum length of initial jump you should make such that you will finally land outside the field by using exactly one booster. Print the minimum length of jump he should make so that he will land on other side of river by using one stone .
INPUT FORMAT :
The first line contain
the number of stones in the river .
Second line contain
space separated integers representing the power of each stone A , A, A………… A[n] .
OUTPUT FORMAT :
Output the minimum length of jump so he will cross the river using one stone .
1< N< 106
1< A[i] <106