#include <bits/stdc++.h>
using namespace std;
int a[100001];
int main() {
  ios::sync_with_stdio(0);
  int n, mn = 1e9;
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
    mn = min(mn, a[i]);
  }
  int last = -1;
  int ans = n + 1e1;
  for (int i = 1; i <= n; ++i) {
    if (a[i] == mn) {
      if (last != -1) {
        ans = min(ans, i - last);
      }
      last = i;
    }
  }
  cout << ans;
  return 0;
}
