#include <bits/stdc++.h>
using namespace std;
int a[100005];
int main() {
  for (int i = 0; i < 100; i++) {
    int a = i;
  }
  int n;
  scanf("%d", &n);
  int minn = 100005;
  int minx = 1000000001;
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    minx = min(minx, a[i]);
  }
  int pre = -1;
  for (int i = 0; i < n; i++) {
    if (a[i] == minx && pre != -1) {
      minn = min(minn, i - pre);
      pre = i;
    } else if (pre == -1 && a[i] == minx)
      pre = i;
  }
  cout << minn << endl;
  return 0;
}
