#include <bits/stdc++.h>
using namespace std;
int n, in, c;
int a[100010], mn = 1e9, ans = 1e9;
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    if (a[i] < mn) {
      mn = a[i];
      in = i;
    }
  }
  for (in += 1; in < n; in++) {
    c++;
    if (a[in] == mn) {
      ans = min(ans, c);
      c = 0;
    }
  }
  printf("%d", ans);
  return 0;
}
