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;
const int INF = int(1e9);
const int INF64 = int(1e18);
template <class A>
ostream& operator<<(ostream& out, const vector<A>& v) {
  out << "[";
  for (int i = 0; i < int(int((v).size())); i++) {
    if (i) out << ", ";
    out << v[i];
  }
  return out << "]";
}
int binpow(int a, int n) {
  if (n == 0) return 1;
  if (n % 2 == 0) {
    int d = binpow(a, n / 2);
    return d * d;
  }
  if (n % 2 != 0) {
    return binpow(a, n - 1) * a;
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  vector<int> a(n);
  vector<int> posOfMin;
  int min = INF;
  for (int i = 0; i < int(n); i++) {
    cin >> a[i];
    if (a[i] < min) {
      min = a[i];
    }
  }
  for (int i = 0; i < int(n); i++) {
    if (a[i] == min) {
      posOfMin.push_back(i);
    }
  }
  int minD = INF;
  for (int i = 0; i < int(posOfMin.size() - 1); i++) {
    if (posOfMin[i + 1] - posOfMin[i] < minD) {
      minD = posOfMin[i + 1] - posOfMin[i];
    }
  }
  cout << minD;
  return 0;
}
