#include <bits/stdc++.h>
using namespace std;
int n, a[100005], b[100005], c[100005];
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  int m = a[1];
  for (int i = 2; i <= n; i++)
    if (a[i] < m) m = a[i];
  int t = 1;
  for (int i = 1; i <= n; i++)
    if (a[i] == m) b[t] = i, t++;
  sort(b + 1, b + t);
  for (int i = 2; i < t; i++) c[i - 1] = b[i] - b[i - 1];
  sort(c + 1, c + t - 1);
  cout << c[1];
}
