You are given an array of n integer numbers a0, a1, ..., an - 1. Find the distance between two closest (nearest) minimums in it. It is guaranteed that in the array a minimum occurs at least two times.

Input

The first line contains positive integer n (2 ≤ n ≤ 105) — size of the given array. The second line contains n integers a0, a1, ..., an - 1 (1 ≤ ai ≤ 109) — elements of the array. It is guaranteed that in the array a minimum occurs at least two times.

Output

Print the only number — distance between two nearest minimums in the array.

Examples

Input

2
3 3


Output

1


Input

3
5 6 5


Output

2


Input

9
2 1 3 5 4 1 2 3 1


Output

3
#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1);
const long long MO = 1e9 + 7;
const long long Inv2 = (MO + 1) / 2;
const bool debug = true;
template <typename T>
inline void read(T &x) {
  x = 0;
  char c;
  T t = 1;
  while (((c = getchar()) < '0' || c > '9') && c != '-')
    ;
  if (c == '-') {
    t = -1;
    c = getchar();
  }
  do (x *= 10) += (c - '0');
  while ((c = getchar()) >= '0' && c <= '9');
  x *= t;
}
template <typename T, typename... Args>
inline void read(T &x, Args &...args) {
  read(x), read(args...);
}
template <typename T>
inline void write(T x) {
  int len = 0;
  char c[21];
  if (x < 0) putchar('-'), x *= (-1);
  do {
    ++len;
    c[len] = (x % 10) + '0';
  } while (x /= 10);
  for (int i = (len); i >= (1); --i) putchar(c[i]);
}
int n, a[100005], minx;
inline int ac() {
  read(n);
  for (int i = (1); i <= (n); ++i) read(a[i]);
  minx = a[1];
  for (int i = (1); i <= (n); ++i) minx = min(minx, a[i]);
  int ans = n, pos = 0;
  for (int i = (1); i <= (n); ++i) {
    if (a[i] != minx) continue;
    if (pos == 0) {
      pos = i;
      continue;
    }
    ans = min(ans, i - pos);
    pos = i;
  }
  cout << ans;
  return 0;
}
int main() {
  ac();
  return 0;
}
