#include <bits/stdc++.h>
int A[100020] = {0};
int main() {
  int n, i, dis1, dis2 = 0, dis = 0, min;
  scanf("%d", &n);
  for (i = 1; i <= n; i++) {
    scanf("%d", &A[i]);
    if (min > A[i] || i == 1) min = A[i];
  }
  for (i = 1; i <= n; i++)
    if (A[i] == min) {
      if (dis2 == 0) dis2 = i;
      dis1 = dis2;
      dis2 = i;
      if (dis > dis2 - dis1 || dis == 0) dis = dis2 - dis1;
    }
  printf("%d", dis);
  return 0;
}
