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;
long long gcd(long long x, long long y) {
  if (y == 0)
    return x;
  else
    return gcd(y, x % y);
}
long long swap(long long *x, long long *y) {
  long long temp = *x;
  *x = *y;
  *y = temp;
}
int main() {
  long long t = 1;
  while (t--) {
    long long i, j, k, x, x1, x2, x3, y, y1, y2, y3, n, m;
    long long flag = 0, f = 0, sum = 0, count = 0, ans = 1000000007, diff = 0,
              prod = 0, count1 = 0, count2 = 0;
    cin >> n;
    long long a[n];
    for (i = 0; i < n; i++) cin >> a[i];
    x = a[0];
    for (i = 0; i < n; i++) {
      if (a[i] < x) x = a[i];
    }
    for (i = 0; i < n; i++) {
      if (a[i] == x) {
        break;
      }
    }
    x1 = i;
    for (j = i + 1; j < n; j++) {
      if (a[j] == x) {
        ans = min(ans, j - x1);
        x1 = j;
      }
    }
    cout << ans << endl;
  }
  return 0;
}
