#include <bits/stdc++.h>
using namespace std;
int MIN = 0x7fffffff;
int main() {
  int n, i, j, loc1, loc2 = 100010;
  int num[100050];
  scanf("%d", &n);
  for (i = 1; i <= n; i++) {
    cin >> num[i];
    if (num[i] < MIN) {
      MIN = num[i];
      loc1 = i;
    }
  }
  for (i = loc1 + 1; i <= n; i++) {
    if (num[i] == MIN) {
      loc2 = min(loc2, i - loc1);
      loc1 = i;
    }
  }
  cout << loc2 << endl;
  return 0;
}
