#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
int a[100005];
int main() {
  int n;
  scanf("%d", &n);
  int minn = inf, ans = inf, k;
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    if (a[i] < minn) {
      minn = a[i];
      k = i;
    }
  }
  int m = k;
  for (int i = k + 1; i < n; i++) {
    if (a[i] == minn) {
      ans = min(ans, abs(k - i));
      k = i;
    }
  }
  printf("%d\n", ans);
  return 0;
}
