#include <bits/stdc++.h>
int n;
int a[200000];
int main() {
  scanf("%d", &n);
  int min = 2147483647;
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    if (min > a[i]) min = a[i];
  }
  int now = -1000000011, ans = 2147483647;
  for (int i = 0; i < n; i++)
    if (a[i] == min) {
      if (i - now < ans) ans = i - now;
      now = i;
    }
  printf("%d\n", ans);
  return 0;
}
