#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> v(n);
  for (auto &x : v) cin >> x;
  int mine = *min_element(v.begin(), v.end());
  vector<int> temp;
  for (int i = 0; i < n; i++) {
    if (v[i] == mine) temp.push_back(i);
  }
  for (int i = 0; i < temp.size() - 1; i++) temp[i] = temp[i + 1] - temp[i];
  cout << *min_element(temp.begin(), temp.end() - 1) << endl;
}
