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
import operator as op
import re
import sys
from bisect import bisect, bisect_left, insort, insort_left
from collections import Counter, defaultdict, deque
from copy import deepcopy
from decimal import Decimal
from functools import reduce
from itertools import (
    accumulate, combinations, combinations_with_replacement, groupby,
    permutations, product)
from math import (acos, asin, atan, ceil, cos, degrees, factorial, gcd, hypot,
                  log2, pi, radians, sin, sqrt, tan)
from operator import itemgetter, mul
from string import ascii_lowercase, ascii_uppercase, digits


def inp():
    return(int(input()))


def inlist():
    return(list(map(int, input().split())))


def instr():
    s = input()
    return(list(s[:len(s)]))


def invr():
    return(map(int, input().split()))


def def_value():
    return 0


def time_lagbe(n, k, t):
    if n == 0:
        return 0
    if k > n:
        return t
    time1 = (n // k)*t + (n % k)*t
    return time1
# For getting input from input.txt file
#sys.stdin = open('input.txt', 'r')
# Printing the Output to output.txt file
#sys.stdout = open('output.txt', 'w')


n = inp()
a = inlist()

mn = min(a)
b = []
for i in range(n):
    if a[i] == mn:
        b.append(i)
min_dis = 100000000000
for i in range(len(b)-1):
    if b[i+1] - b[i] < min_dis:
        min_dis = b[i+1] - b[i]
print(min_dis)
