#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, num, ans = INT_MAX, minn = INT_MAX, ind;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> num;
    if (minn > num) {
      minn = num;
      ind = i;
      ans = INT_MAX;
    } else if (minn == num) {
      ans = min(ans, i - ind);
      ind = i;
    }
  }
  cout << ans;
}
