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.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;


public class A911 {

	private static boolean home = !"true".equals(System.getProperty("ONLINE_JUDGE"));
	private static boolean debug = false;
	
	public static void main(String[] args) throws IOException {
		int nrTeste = 3;
String[] inputs = {"2\n3 3\n", "3\n5 6 5\n", "9\n2 1 3 5 4 1 2 3 1\n"};
String[] expected = {"1\n", "2\n", "3\n"};
		for (int i = 0; home && i < nrTeste; i++) {
			System.out.print("\nExpect: " + expected[i] + "\n   Got: ");
			System.setIn(new ByteArrayInputStream(inputs[i].getBytes()));
			solve();
		}
		if (!home) {
			solve();
		}
		System.out.close();
	}
	
	public static void solve() throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		PrintWriter pw = new PrintWriter(System.out);
		String[] line;
		line = br.readLine().split(" ");
		int n = Integer.parseInt(line[0]);
		line = br.readLine().split(" ");
		int[] nrs = new int[n];
		int min = Integer.MAX_VALUE;
		int dist = n;
		int last = -1;
		for (int i = 0; i < n; i++) {
			nrs[i] = Integer.parseInt(line[i]);
			if (nrs[i] < min) {
				min = nrs[i];
				dist = n;
				last = i;
			} else if (nrs[i] == min) {
				if ( i - last < dist) {
					dist = i - last;
				}
				last = i;
			}
		}
		pw.println(dist);
		
		br.close();
		pw.flush();
	}
	
}
