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


import java.util.*;


public class Main {

    static boolean ckeckB(int[]c,int[]f){

        for (int i = 0; i < 26; i++) {
            if (c[i]>f[i])return false;
        }
        for (int i = 0; i < 26; i++) {
            f[i]-=c[i];
        }
        return true;

    }


    public static void main(String[] args) throws IOException {
        Scanner in = new Scanner(System.in);


        try (PrintWriter or = new PrintWriter(System.out)) {



            int n=in.nextInt();
            int[]a=new int[n];
            int min=Integer.MAX_VALUE;
            for (int i = 0; i < n; i++) {
                a[i]=in.nextInt();
                min=Math.min(a[i],min);
            }
            int idx=-1,ans=Integer.MAX_VALUE;
            for (int i = 0; i < n; i++) {
                if (a[i]==min){
                    if (idx==-1)idx=i;
                    else {
                        ans=Math.min(ans,i-idx);
                        idx=i;
                    }
                }
            }
            or.println(ans);

        }

    }








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







    static class Scanner {

        StringTokenizer st;
        BufferedReader br;

        public Scanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

        public String next() throws IOException {
            while (st == null || !st.hasMoreTokens()) {
                st = new StringTokenizer(br.readLine());
            }
            return st.nextToken();
        }

        public int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

        public long nextLong() throws IOException {
            return Long.parseLong(next());
        }

        public String nextLine() throws IOException {
            return br.readLine();
        }

        public double nextDouble() throws IOException {
            String x = next();
            StringBuilder sb = new StringBuilder("0");
            double res = 0, f = 1;
            boolean dec = false, neg = false;
            int start = 0;
            if (x.charAt(0) == '-') {
                neg = true;
                start++;
            }
            for (int i = start; i < x.length(); i++) {
                if (x.charAt(i) == '.') {
                    res = Long.parseLong(sb.toString());
                    sb = new StringBuilder("0");
                    dec = true;
                } else {
                    sb.append(x.charAt(i));
                    if (dec) {
                        f *= 10;
                    }
                }
            }
            res += Long.parseLong(sb.toString()) / f;
            return res * (neg ? -1 : 1);
        }

        public boolean ready() throws IOException {
            return br.ready();
        }

    }
}

class Pair implements Comparable<Pair> {
    int first, second;

    public Pair(int first, int second) {
        this.first = first;
        this.second = second;
    }


    @Override
    public int compareTo(Pair o) {
        if (first!=o.first)return first-o.first;
        return second-o.second;
    }
}

class Tempo {

    int first, second, third;

    public Tempo(int first, int second, int third) {
        this.first = first;
        this.second = second;
        this.third = third;
    }
}