#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  int n;
  cin >> n;
  int a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  int mi = *min_element(a, a + n);
  int p = -1;
  int f = 0;
  int ans = INT_MAX;
  for (int i = 0; i < n; i++) {
    if (a[i] == mi and !f) {
      f = 1;
      p = i;
    } else if (a[i] == mi and f) {
      ans = min(ans, i - p);
      p = i;
    }
  }
  cout << ans;
}
