You are given an array of n integer numbers a0, a1, ..., an - 1. Find the distance between two closest (nearest) minimums in it. It is guaranteed that in the array a minimum occurs at least two times.

Input

The first line contains positive integer n (2 ≤ n ≤ 105) — size of the given array. The second line contains n integers a0, a1, ..., an - 1 (1 ≤ ai ≤ 109) — elements of the array. It is guaranteed that in the array a minimum occurs at least two times.

Output

Print the only number — distance between two nearest minimums in the array.

Examples

Input

2
3 3


Output

1


Input

3
5 6 5


Output

2


Input

9
2 1 3 5 4 1 2 3 1


Output

3
n = int(input())
mins = []
cmin = 99999999999999999
minsindex = []
count = 0
for i in input().split():
    i = int(i)
    if i <= cmin:
        cmin = i
        mins.append(i)
        minsindex.append(count)
    count += 1
minofmin = min(mins)
i = 0
while i < len(mins):
    if mins[i] != minofmin:
        del mins[i]
        del minsindex[i]
    else:
        i += 1
minlenght = 999999999999999
for i in range(1, len(minsindex)):
    if minsindex[i] - minsindex[i - 1] < minlenght:
        minlenght = minsindex[i] - minsindex[i - 1]
print(minlenght)