#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long int n;
  cin >> n;
  vector<long long int> a(n);
  for (__typeof(n) i = (0) - ((0) > (n)); i != (n) - ((0) > (n));
       i += 1 - 2 * ((0) > (n)))
    cin >> a[i];
  long long int prev = -1000000005;
  long long int ans = 1000000005;
  long long int mi = *min_element(a.begin(), a.end());
  for (long long int i = 0; i < n; i++) {
    if (a[i] == mi) {
      ans = min(ans, i - prev);
      prev = i;
    }
  }
  cout << ans;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int test;
  test = 1;
  while (test--) {
    solve();
    cout << '\n';
  }
  return 0;
}
