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