#include <bits/stdc++.h>
using namespace std;
int n, a[100005];
int mn = 1000000005, ans = 100005;
int main() {
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    mn = min(a[i], mn);
  }
  vector<int> v;
  for (int i = 0; i < n; ++i)
    if (a[i] == mn) v.push_back(i + 1);
  for (int i = 1; i < (int)v.size(); ++i) ans = min(ans, v[i] - v[i - 1]);
  cout << ans << endl;
  return 0;
}
