#include <bits/stdc++.h>
using namespace std;
const double EPS = 1e-9;
const double PI = 3.141592653589793238462;
const int dr[] = {1, 1, 0, -1, -1, -1, 0, 1};
const int dc[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int dx[] = {1, 0, -1, 0};
const int dy[] = {0, 1, 0, -1};
long long arr[100005];
int main() {
  ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  long long mini = *min_element(arr, arr + n);
  int f = 0, ans = n + 5, last;
  for (int i = 0; i < n; i++) {
    if (arr[i] != mini) continue;
    if (f) {
      ans = min(ans, i - last);
      last = i;
    } else {
      last = i;
      f = 1;
    }
  }
  cout << ans << '\n';
  return 0;
}
