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.*;
import java.util.function.*;
import java.util.stream.*;
import static java.util.Arrays.*;
import static java.lang.Math.*;
import static java.lang.System.arraycopy;
import static java.lang.Integer.parseInt;
import static java.lang.Long.parseLong;

public class Main {

  public static void main(String[] args) {
    MyScanner sc = new MyScanner(System.in);
    PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));

    int n = sc.nextInt();
    int[] values = new int[n]; // ++  []
    int m = Integer.MAX_VALUE;
    for (int i = 0; i < n; i++) {
      values[i] = sc.nextInt();
      m = min(m, values[i]);
    }

    int prev = -1;
    int min = Integer.MAX_VALUE;

    for (int i = 0; i < n; i++) {
      // if ( (i == 0 || value <= values[i - 1]) && (i == n - 1 || value <= values[i + 1]) ) { // @run  <  ->  <=  #requirements
      if (values[i] == m) { // + @run
        if (prev != -1) {
          min = min(min, i - prev);
        }
        prev = i;
      }
    }

    out.println(min);
    out.close();
  }

  static class MyScanner {
    public BufferedReader reader;
    public StringTokenizer tokenizer = null;
    public MyScanner(InputStream stream) {
      reader = new BufferedReader(new InputStreamReader(stream), 32768);
    }
    public String next() {
      while (tokenizer == null || !tokenizer.hasMoreTokens()) {
        try { tokenizer = new StringTokenizer(reader.readLine()); }
        catch (IOException e) { throw new RuntimeException(e); }
      }
      return tokenizer.nextToken();
    }
    public int nextInt() { return Integer.parseInt(next()); }
    public long nextLong() { return Long.parseLong(next()); }
  }
}

