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


public class Main {

    public static void main(String[] args) throws IOException {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        InputReader.OutputWriter out = new InputReader.OutputWriter(outputStream);

        int n = in.nextInt();
        int [] a = new int[n];
        for (int i = 0; i < a.length; i++) {
            a[i] = in.nextInt();
        }
        int min = Integer.MAX_VALUE;
        for (int i : a) {
            min = Math.min(i,min);
        }
        HashSet<Integer> set = new HashSet<>();
        for (int i = 0; i < a.length; i++) {
            if(a[i] == min) {
                set.add(i);
            }
        }
        int [] b = new int[set.size()];
        int index = 0;
        for(int i : set) {
            b[index++] = i;
        }
        Arrays.sort(b);
        int m = Integer.MAX_VALUE;
        for (int i = 0; i < b.length - 1; i++) {
            m = Math.min(m,b[i+1] - b[i]);
        }
        out.println(m);

        out.flush();

    }
    static int solve(int k,int n,int a,int b) {
        int min = Math.min(a,b);
        int max = 0;
        while (n-->0) {
            if(k<=min) return -1;
            if(k>a) {
                max++;
                k-=a;
            }
            else if(k>b) {
                k-=b;
            }
        }
        if(k>0) return max;
        return 0;
    }
    static void shuffle(int [] a) {
        for (int i = 0; i < a.length; i++) {
            int index = (int)(Math.random()*a.length);
            int temp = a[index];
            a[index] = a[i];
            a[i] = temp;
        }
    }
    static int solve(int [] a, int k) {
        int [] b = new int[a.length];
        for (int i = 0; i < a.length; i++) {
            b[i] = a[i] + k;
        }
        int max = -1;
        for (int i = 0; i < b.length; i++) {
            boolean flag = true;
            for (int j = 0; j < a.length; j++) {
                if(Math.abs(a[j] - b[i])>k) {
                    flag = false;
                    break;
                }
            }
            if(flag) {
                max = Math.max(max,b[i]);
            }
        }
        return max;
    }
    static boolean check(int n) {
        int sum = 0;
        while (n>0) {
            int k = n%10;
            sum+=k;
            n/=10;
        }
        return sum%4==0;
    }
}

class InputReader extends BufferedReader {
    StringTokenizer tokenizer;

    public InputReader(InputStream inputStream) {
        super(new InputStreamReader(inputStream), 32768);
    }

    public InputReader(String filename) {
        super(new InputStreamReader(Thread.currentThread().getContextClassLoader().getResourceAsStream(filename)));
    }

    public String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(readLine());
            } catch (IOException e) {
                throw new RuntimeException();
            }
        }
        return tokenizer.nextToken();
    }

    public Integer nextInt() {
        return Integer.valueOf(next());
    }
    public Long nextLong() {return  Long.valueOf(next());}

    static class OutputWriter extends PrintWriter {
        public OutputWriter(OutputStream outputStream) {
            super(outputStream);
        }

        public OutputWriter(Writer writer) {
            super(writer);
        }

        public OutputWriter(String filename) throws FileNotFoundException {
            super(filename);
        }

        public void close() {
            super.close();
        }
    }
}