#include <bits/stdc++.h>
using namespace std;
void swapi(int *a, int *b) {
  int temp;
  temp = *a;
  *a = *b;
  *b = temp;
}
void swapc(char *a, char *b) {
  char temp;
  temp = *a;
  *a = *b;
  *b = temp;
}
template <typename T>
void fscan(T &x) {
  x = 0;
  bool neg = 0;
  register T c = getchar();
  if (c == '-') neg = 1, c = getchar();
  while ((c < 48) || (c > 57)) c = getchar();
  for (; c < 48 || c > 57; c = getchar())
    ;
  for (; c > 47 && c < 58; c = getchar()) x = (x << 3) + (x << 1) + (c & 15);
  if (neg) x *= -1;
}
template <typename T>
void fprint(T n) {
  bool neg = 0;
  if (n < 0) n *= -1, neg = 1;
  char snum[65];
  int i = 0;
  do {
    snum[i++] = n % 10 + '0';
    n /= 10;
  } while (n);
  --i;
  if (neg) putchar('-');
  while (i >= 0) putchar(snum[i--]);
  putchar('\n');
}
template <typename T, typename U>
static inline void amin(T &x, U y) {
  if (y < x) x = y;
}
template <typename T, typename U>
static inline void amax(T &x, U y) {
  if (x < y) x = y;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, i, min, last, min1;
  cin >> n;
  int v[n];
  for (i = 0; i < n; i++) {
    cin >> v[i];
  }
  min = v[0];
  for (i = 0; i < n; i++) {
    if (v[i] < min) min = v[i];
  }
  for (i = 0; i < n; i++) {
    if (v[i] == min) {
      last = i;
      break;
    }
  }
  min1 = n;
  for (i = last + 1; i < n; i++) {
    if (v[i] == min) {
      if (i - last < min1) min1 = i - last;
      last = i;
    }
  }
  cout << min1 << '\n';
  return 0;
}
