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