#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n;
  cin >> n;
  long long int mini = 9999999999;
  long long int arr[n];
  for (long long int i = 0; i < n; i++) {
    cin >> arr[i];
    mini = min(arr[i], mini);
  }
  long long int ans = 9999999999, count = 0;
  for (long long int i = 0; i < n; i++)
    if (arr[i] == mini) {
      count = i;
      break;
    }
  for (long long int i = count + 1; i < n; i++) {
    if (arr[i] == mini) {
      ans = min(i - count, ans);
      count = i;
    }
  }
  cout << ans;
}
