#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n, l, r, t = 1e12;
  cin >> n;
  long long a[n], m = 1e12;
  vector<long long> A;
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
    if (a[i] < m) m = a[i];
  }
  for (long long i = 0; i < n; i++) {
    if (a[i] == m) A.push_back(i);
  }
  for (long long i = 0; i < A.size() - 1; i++) {
    if (A[i + 1] - A[i] < t) t = A[i + 1] - A[i];
  }
  cout << t;
}
