#include <bits/stdc++.h>
using namespace std;
int main() {
  int ans = 1e9;
  int n;
  cin >> n;
  int menor = 1e9;
  int vet[n];
  for (int i = 0; i < n; i++) {
    cin >> vet[i];
    menor = min(menor, vet[i]);
  }
  int ant = -1e9;
  for (int i = 0; i < n; i++) {
    if (vet[i] == menor) {
      ans = min(ans, (i - ant));
      ant = i;
    }
  }
  cout << ans << endl;
}
