#include <bits/stdc++.h>
int a[100005];
int main(int argc, char** argv) {
  int i, n, m, ans, p = -1000000;
  ans = m = 1000000000;
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    if (a[i] < m) m = a[i];
  }
  for (i = 0; i < n; i++)
    if (a[i] == m) {
      if (i - p < ans) ans = i - p;
      p = i;
    }
  printf("%d\n", ans);
  return 0;
}
