#include <bits/stdc++.h>
using namespace std;
int a[100000];
int main() {
  int n, min1 = 100000;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  int x = a[0], y = 0;
  for (int i = 1; i < n; i++) {
    if (x > a[i]) {
      x = a[i];
      y = i;
    }
  }
  for (int i = 0; i < n; i++)
    if (x == a[i] && y != i) {
      min1 = min(min1, abs(y - i));
      y = i;
    }
  cout << min1 << endl;
  return 0;
}
