#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  long long arr[100010];
  map<long long, long long> m;
  map<long long, long long> k;
  scanf("%lld", &n);
  long long me = LONG_LONG_MAX;
  for (int i = 0; i < n; i++) {
    scanf("%lld", &arr[i]);
    me = min(me, arr[i]);
  }
  long long cnt = 0, fpos, ans, mi = LONG_LONG_MAX;
  for (int i = 0; i < n; i++) {
    if (arr[i] == me && cnt != 1) {
      cnt = 1;
      fpos = i;
    } else if (arr[i] == me && cnt == 1) {
      ans = i - fpos;
      fpos = i;
      mi = min(ans, mi);
    }
  }
  cout << mi << endl;
  return 0;
}
