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

/*
ID: grifync1
LANG: JAVA
PROG: nearmin
*/

//lil lil peezy
import java.util.*;
import java.io.*;

public class nearmin {
	public static int conv(String s) {
		return Integer.parseInt(s);
	}

	public static int max(int a, int b) {
		return Math.max(a, b);
	}

	public static int min(int a, int b) {
		return Math.min(a, b);
	}

	public static void print(int num) {
		System.out.println(num);
	}

	public static void prints(String s) {
		System.out.println(s);
	}

	public static void printa(int[] a) {
		for (int i = 0; i < a.length; i++) {
			if (i == 0) {
				System.out.print(a[i]);
			} else {
				System.out.print(" " + a[i]);
			}
		}
	}

	public static int[] sort(int[] nums) {
		Arrays.sort(nums);
		return nums;
	}

	public static void main(String[] args) throws IOException {
		//BufferedReader in = new BufferedReader(new FileReader("nearmin.in"));
		//PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("nearmin.out")));
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		PrintWriter out = new PrintWriter(System.out);
		//StringTokenizer st = new StringTokenizer(in.readLine());
		int len = conv(in.readLine());
		StringTokenizer st = new StringTokenizer(in.readLine());
		List<Integer> nums = new ArrayList<Integer>();
		int mindex=  0;
		int min = Integer.MAX_VALUE;
		for(int i=0; i<len; i++) {
			nums.add(conv(st.nextToken()));
			min = min(min,nums.get(i));
			
		}
		mindex = nums.indexOf(min);
		boolean found = false;
		int index = mindex+1;
		int dist = 1;
		int mindist = Integer.MAX_VALUE;
		if(len==2) {
			out.println(1);
		}
		else {
			while(index<len) {
				if(nums.get(index)==min ) {
					mindist=min(dist,mindist);
					dist=1;
					index++;
				}
				else {
					index++;
					dist++;
				}
			}
			out.println(mindist);
		}
		
		in.close();
		out.close();
	}

}
