#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 10;
const int INF = 0x7fffffff;
int a[maxn], b[maxn];
int main() {
  int n, ans = INF, flag = INF, x;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    flag = min(flag, a[i]);
  }
  int k = 0;
  for (int i = 0; i < n; i++) {
    if (a[i] == flag) b[k++] = i;
  }
  for (int i = 1; i < k; i++) {
    ans = min(ans, b[i] - b[i - 1]);
  }
  printf("%d\n", ans);
  return 0;
}
