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.Scanner;

public class p911a {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        int length = scanner.nextInt();
        int[] arr = new int[length];

        for (int i = 0; i < length; ++i) {
            arr[i] = scanner.nextInt();
        }

        scanner.close();

        System.out.println(findMinimumDistanceBetweenGlobalMinimum(arr));
    }

    private static int findMinimumDistanceBetweenGlobalMinimum(int[] arr) {
        ArrayList<Integer> mins = new ArrayList<Integer>();

        int min = arr[0];
        mins.add(0);

        for (int i = 1; i < arr.length; ++i) {
            if (arr[i] < min) {
                mins.clear();
                mins.add(i);

                min = arr[i];
            } else if (arr[i] == min) {
                mins.add(i);
            }
        }

        int minMin = mins.get(1) - mins.get(0);
        for (int i = 2; i < mins.size(); ++i) {
            int distance = mins.get(i) - mins.get(i - 1);
            if (distance < minMin) {
                minMin = distance;
            }
        }

        return minMin;
    }

    private static int findMinimumDistanceBetweenLocalMinimums(int[] arr) {
        ArrayList<Integer> mins = new ArrayList<Integer>();

        boolean dec = true;
        int minIdx = 0;
        for (int i = 1; i < arr.length; ++i) {
            if (arr[i] < arr[i - 1]) {
                dec = true;
                minIdx = i;
            } else if (arr[i] == arr[i - 1] && dec) {
                mins.add(minIdx);
                minIdx = i;
            } else {
                if (dec) {
                    dec = false;
                    mins.add(minIdx);
                }
            }
        }

        // If we were decreasing at the end, the last value is a minimum
        if (dec) {
            mins.add(arr.length - 1);
        }

        int minMin = mins.get(1) - mins.get(0);
        for (int i = 2; i < mins.size(); ++i) {
            int distance = mins.get(i) - mins.get(i - 1);
            if (distance < minMin) {
                minMin = distance;
            }
        }

        return minMin;
    }
}
