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;
template <typename T, typename U>
std::pair<T, U> operator+(const std::pair<T, U>& l, const std::pair<T, U>& r) {
  return {l.first + r.first, l.second + r.second};
}
typedef void (*callback_function)(void);
const long long ZERO = 0LL;
const long long INF64 = 1e18;
const long long INF32 = 1e9;
const long long MOD = 1e9 + 7;
const long double PI = acos(-1.0L);
const long double EPS = static_cast<long double>(1e-9);
inline long long Pow(long long a, long long k) {
  long long s = 1;
  for (; k; k >>= 1) {
    k& 1 ? s = 1LL * s * a % MOD : 0;
    a = 1LL * a * a % MOD;
  }
  return s;
}
const long long N = 1e6 + 7;
void input() {}
void preprocess() {}
void debug() {
  if (true) {
  }
}
void solve() {
  preprocess();
  long long n;
  cin >> n;
  long long a[n];
  for (long long i = (0); i < (n); i++) {
    cin >> a[i];
  }
  long long mn = *min_element(a, a + n);
  long long res = INF64;
  long long prev = -n;
  for (long long i = (0); i < (n); i++) {
    if (mn == a[i]) {
      res = min(res, i - prev);
      prev = i;
    }
  }
  cout << res << endl;
}
void output() {}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie();
  {
    input();
    solve();
    output();
  }
  return 0;
}
