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 java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;

//Nearest Minimums
public class A911 {
	public static void main(String arg[]) {
		int save=-1;
		int min=Integer.MAX_VALUE;
		Scanner sc = new Scanner(System.in);
		int itr = sc.nextInt();
		ArrayList<Long> al = new ArrayList<Long>();
		for(int i=0;i<itr;i++) {
			al.add(sc.nextLong());
		}
		long minimum = (Long) Collections.min(al);
		//System.out.println(minimum);
		for(int i=0;i<itr;i++) {
			//System.out.println(al.get(i));
			if(minimum==al.get(i)) {
				
				if(save==-1) {
					save=i;
				}
				else {
					//System.out.println(min+">"+(i-save));
					if(min>(i-save)) {
						min = (i-save);
						//System.out.println("mi "+ min);
						save=i;
					}
					else {
						save=i;
					}
				}
			}
		}
		if(min!=Integer.MAX_VALUE)
			System.out.println(min);
		else System.out.println("1");
	}
}
//2 3 4 2 3 4 3 5 4 4  2  5  4  4  4  4  4  4  5  3  5  3  3  4  4  5  5  3  4  5  3  5  2  5  2  4  2
//0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
