#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i, arr[200005], mini = 1e9 + 7, pre, ans = 200005;
  scanf("%d", &n);
  for (i = 0; i < n; ++i) {
    scanf("%d", &arr[i]);
    mini = min(mini, arr[i]);
  }
  for (i = 0; i < n; ++i) {
    if (arr[i] == mini) {
      pre = i;
      break;
    }
  }
  ++i;
  for (; i < n; ++i) {
    if (arr[i] == mini) {
      ans = min(ans, i - pre);
      pre = i;
    }
  }
  printf("%d\n", ans);
  return 0;
}
