#include <bits/stdc++.h>
using namespace std;
int n, arr[100010], mn = 1000000000, st, ans = 1000000000;
bool b;
int main() {
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> arr[i];
    mn = min(mn, arr[i]);
  }
  for (int i = 0; i < n; ++i) {
    if (arr[i] == mn && !b) {
      st = i;
      b = 1;
    } else if (arr[i] == mn) {
      ans = min(ans, i - st);
      st = i;
    }
  }
  cout << ans;
  return 0;
}
