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
from sys  import stdin,stdout
from math import floor
st=lambda:list(stdin.readline().strip())
li=lambda:list(map(int,stdin.readline().split()))
mp=lambda:map(int,stdin.readline().split())
inp=lambda:int(stdin.readline())
pr=lambda n: stdout.write(str(n)+"\n")

mod=1000000007
'''
prime=[]
i=2
l=[True for i in range(10**5+1)]
while i*i <= 10**5 :
    if l[i]:
        for j in range(i*i,10**5+1,i):
            l[j]=False
    i+=1
for i in range(2,10**5+1):
    if l[i]:
        prime.append(i)
'''

def solve():
    n=inp()
    l=li()
    a=min(l)
    x=[]
    for i in range(n):
        if l[i]==a:
            x.append(i)
    
    mi=float('inf')
    for i in range(1,len(x)):
        mi=min(mi,x[i]-x[i-1])
    pr(mi)
            
    
    
for _ in range(1):
    solve()

