#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e18, MAXN = 1e5 + 100;
int n, a[MAXN], mn = 1e9 + 100, ls = -1e9, ans = 1e9 + 100;
int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i], mn = min(mn, a[i]);
  for (int i = 0; i < n; i++) {
    if (a[i] == mn) {
      ans = min(ans, i - ls);
      ls = i;
    }
  }
  cout << ans;
}
