#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  long long a[n];
  long long mn = 1e15;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    mn = min(a[i], mn);
  }
  long long l = -1;
  long long ans = 1e7;
  for (long long i = 0; i < n; i++) {
    if (a[i] == mn) {
      if (l != -1) {
        ans = min(ans, i - l);
      }
      l = i;
    }
  }
  cout << ans;
}
