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
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, h = 0, u = 10000009, i, ar[100009], m = 1000000009, d = 10000009,
         mo = 1000000009, p[100009], s = 10000009;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> ar[i];
    if (ar[i] < m) m = ar[i];
  }
  for (i = 0; i < n; i++) {
    if (ar[i] == m) {
      p[h++] = i;
      if (h > 1) u = min(u, p[h - 1] - p[h - 2]);
    }
  }
  if (h > 1)
    cout << u << endl;
  else {
    h = 0;
    for (i = 0; i < n; i++) {
      if (ar[i] < mo && ar[i] > m) {
        mo = ar[i];
      }
    }
    for (i = 0; i < n; i++) {
      if (ar[i] == mo) u = min(u, abs(i - p[0]));
    }
    cout << u << endl;
  }
  return 0;
}
