#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  int mv = 1e9 + 5;
  int dist = 1e9;
  for (int &x : a) {
    cin >> x;
    mv = min(mv, x);
  }
  int last = -1e9;
  for (int i = 0; i < n; i++) {
    if (a[i] == mv) {
      dist = min(dist, i - last);
      last = i;
    }
  }
  cout << dist << endl;
  return 0;
}
