#include <bits/stdc++.h>
using namespace std;
int n;
int a[100010];
int minn = 0x3fffffff;
int ans = 0x3fffffff, pre = -0x3fffffff;
int main() {
  int i, j, k;
  scanf("%d", &n);
  for (i = 1; i <= n; ++i) {
    scanf("%d", a + i);
    minn = min(minn, a[i]);
  }
  for (i = 1; i <= n; ++i) {
    if (a[i] == minn) {
      ans = min(ans, i - pre);
      pre = i;
    }
  }
  printf("%d\n", ans);
}
