#include <bits/stdc++.h>
using namespace std;
long long p[100005] = {0};
int main() {
  long long n, mn = 1e10;
  cin >> n;
  long long arr[n], small = 1e9 + 5, c = 0;
  ;
  for (long long i = 0; i < n; i++) {
    cin >> arr[i];
    small = min(small, arr[i]);
  }
  for (long long i = 0; i < n; i++) {
    if (arr[i] == small) {
      p[c] = i;
      c++;
    }
  }
  for (long long i = 0; i < n; i++) {
    if (p[i + 1] - p[i] < mn && p[i + 1] != 0) {
      mn = p[i + 1] - p[i];
    }
  }
  cout << mn;
  return 0;
}
