#include <bits/stdc++.h>
int main() {
  int n, a[200003], i, min = 2000000000, mincount = 2000000000, count,
                       last = -1;
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    if (a[i] < min) min = a[i];
  }
  for (i = 0; i < n; i++) {
    if (a[i] == min) {
      if (last == -1) {
        last = i;
      } else {
        count = i - last;
        last = i;
        if (count < mincount) mincount = count;
      }
    }
  }
  printf("%d\n", mincount);
  return 0;
}
