#include <bits/stdc++.h>
using namespace std;
const int N = 1E5 + 7;
int a[N];
int main() {
  ios::sync_with_stdio(false), cin.tie(0);
  int n, mi = 2e9, pre = -1, ans = 2e9;
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i], mi = min(mi, a[i]);
  for (int i = 1; i <= n; i++) {
    if (a[i] == mi) {
      if (pre != -1) {
        ans = min(ans, i - pre);
      }
      pre = i;
    }
  }
  cout << ans << endl;
  return 0;
}
