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.math.BigInteger;
import java.util.*;

public class Watermelon {
    static boolean[] primer = new boolean[1000050];
    static int[] array=new int[10000000];
    static int[][] arr;
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n=sc.nextInt();
        int[] arr=new int[n];
        int min=Integer.MAX_VALUE;
        int index=-1;
        for(int i=0;i<n;i++){
            arr[i]=sc.nextInt();
            min=Math.min(min,arr[i]);
            if(index==-1)
                index=i;
        }
        ArrayList<Integer> list=new ArrayList<>();
        int size=Integer.MAX_VALUE;
        for(int i=0;i<n;i++)
            if(arr[i]==min)
            {
               list.add(i);
            }

        for(int i=1;i<list.size();i++){
            size=Math.min(size,list.get(i)-list.get(i-1));
        }
        System.out.println(size);

    }
    static int get_sum(int i,int j,int len){
        return arr[i][j]-arr[i-len][j]-arr[i][j-len]+arr[i-len][j-len];
    }
    static ArrayList<Integer> divisors(int n) {
        int k=(int)Math.sqrt(n);
        ArrayList<Integer> list = new ArrayList<>();
        for (int i = 1; i <= k + 1; i++) {
            if (n % i == 0) {
                if (n / i == i) list.add(i);
                else {
                    list.add(n / i);
                    list.add(i);
                }
            }
        }
        return list;
    }
    static void sieveOfEratosthenes() {
        int n = 1000001;
        for (int i = 0; i < n; i++)
            primer[i] = true;
        for (int p = 2; p * p <= n; p++) {
            if (primer[p] == true) {
                for (int i = p * 2; i <= n; i += p)
                    primer[i] = false;
            }
        }

    }

    static void recurs(int[][] arr, int x, int y, int value, String[][] sarr, String s) {
        // System.out.println("Heyt");
        try {
            if (value < arr[x][y]) {
                arr[x][y] = value;
                sarr[x][y] = s;
            } else return;
        } catch (Exception e) {
            // System.out.println("Exception");
            return;
        }
        //display(arr);
        //System.out.print("\n");
        recurs(arr, x - 2, y - 1, value + 1, sarr, sarr[x][y] + " UL");
        recurs(arr, x - 2, y + 1, value + 1, sarr, sarr[x][y] + " UR");
        recurs(arr, x, y + 2, value + 1, sarr, sarr[x][y] + " R");
        recurs(arr, x + 2, y + 1, value + 1, sarr, sarr[x][y] + " LR");
        recurs(arr, x + 2, y - 1, value + 1, sarr, sarr[x][y] + " LL");
        recurs(arr, x, y - 2, value + 1, sarr, sarr[x][y] + " L");
    }

    /**
     * Function to update tree
     **/
    static void build(long[] tree, int[] arr, int node, int start, int end) {
        if (start == end) {
            tree[node] = arr[start];
            System.out.println("node " + node + " start " + start + " end " + end + " tree[node] " + tree[node]);
            return;
        }
        int mid = (start + end) >> 1;
        build(tree, arr, 2 * node, start, mid);
        build(tree, arr, 2 * node + 1, mid + 1, end);
        tree[node] = Math.min(tree[2 * node], tree[2 * node + 1]);
        //System.out.println(" start " + start + " end " + end + " tree[node]" + tree[node]);
    }

    private static void update(long[] tree, int node, int pos, long val, int start, int end) {
        //System.out.println("start " + start + " end " + end);
        if (start == end) {
            tree[node] = val;
            //  System.out.println(tree[start]);
            return;
        } else {
            int mid = (start + end) >> 1;
            if (start <= pos && pos <= mid) {
                update(tree, 2 * node, pos, val, start, mid);
            } else {
                update(tree, 2 * node + 1, pos, val, mid + 1, end);
            }
            tree[node] = Math.min(tree[node * 2], tree[node * 2 + 1]);
        }

    }

    /**
     * Function to query
     **/
    private static long query(long[] tree, int node, long l, long r, long start, long end) {
        if (start > r || end < l) return Integer.MAX_VALUE;
        if (start >= l && end <= r) {
            return tree[node];
        }
        long mid = (start + end) >> 1;
        long p1 = query(tree, node * 2, l, r, start, mid);
        long p2 = query(tree, node * 2 + 1, l, r, mid + 1, end);
        // System.out.println(" start " + start + " end " + end + " tree[node]" + tree[node]);
        return Math.min(p1, p2);
    }

    static void display(int[][] dp) {
        for (int i = 0; i < dp.length; i++) {
            for (int j = 0; j < dp[i].length; j++) {
                if (dp[i][j] == Integer.MAX_VALUE) System.out.print("I\t");
                else System.out.print(dp[i][j] + "\t");
            }
            System.out.println();
        }
    }

    static void display(String[][] dp) {
        for (int i = 0; i < dp.length; i++) {
            for (int j = 0; j < dp[i].length; j++) {
                System.out.print(dp[i][j] + "\t\t\t");
            }
            System.out.println();
        }
    }

    static void display(int[] ans) {
        for (int i = 0; i < ans.length; i++)
            System.out.print(ans[i] + " ");
        System.out.println();

    }

    static void display(long[] ans, int n) {
        for (int i = 0; i < n; i++)
            System.out.print(ans[i] + " ");
        System.out.println();

    }

    static int gcd(int a, int b) {
        if (a == 0) return b;
        return gcd(b % a, a);
    }

    // Function to find gcd of array of
// numbers
    static int findGCD(Integer arr[], int n) {
        int result = arr[0];
        for (int i = 1; i < n; i++)
            result = gcd(arr[i], result);
        return result;
    }
}
class Node{
    Node parent;
    ArrayList<Node> list=new ArrayList<>();
    int color=-1;
    int value;
    Node(int value){
        this.value=value;
    }
}