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
'''
	Arpan Tarkas
	IIITDM Jabalpur
'''
 
import sys,math
from collections import defaultdict as df
from bisect import bisect_left as bl

raw_input = lambda: sys.stdin.readline().rstrip()
r_s = lambda: raw_input().strip()                   #read str
r_ss = lambda: raw_input().split()          #read stringss
r_i = lambda: int(raw_input())              #read int
r_is = lambda: map(int, raw_input().split())#read ints
r_f = lambda: float(raw_input())            #read float
r_fs = lambda: map(Decimal, raw_input().split()) #read floats
 
#for efficiently taking lot of space separated queries on each line, use this.
r_qs = lambda: map(lambda s:map(int, s.split(' ')), sys.stdin.readlines())

if __name__ == '__main__':
    #start
    n=r_i()
    ls=r_is()
    m=min(ls)
    ss=sys.maxint
    pre=ls.index(m)
    for i in xrange(pre+1,n):
        if ls[i]==m:
            pp=i-pre
            ss=min(ss,pp)
            pre=i
    print ss
    