#include <bits/stdc++.h>
using namespace std;
int maxn = 1e9 + 10;
int main() {
  int n;
  cin >> n;
  int minn = maxn;
  int ans = maxn;
  int pre = 0;
  for (int i = 0; i < n; i++) {
    int num;
    cin >> num;
    pre++;
    if (num < minn) {
      minn = num;
      ans = maxn;
      pre = 0;
      continue;
    }
    if (num == minn) {
      if (pre < ans) ans = pre;
      pre = 0;
      continue;
    }
  }
  cout << ans << endl;
}
