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 long long mod = 1e9 + 07;
const long long mxn = 1e15 + 10;
int main(int argc, char const *argv[]) {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long i, j, a, b, c, d, n, m, t, h, u, v;
  cin >> n;
  long long mn1 = mxn, mn2 = mxn;
  map<long long, long long> pos;
  for (i = 1; i <= n; i++) {
    cin >> m;
    if (pos[m]) {
      long long gap = i - pos[m];
      if (m < mn1) {
        mn1 = m;
        mn2 = gap;
      } else if (m == mn1) {
        mn2 = min(mn2, gap);
      }
    }
    pos[m] = i;
  }
  cout << mn2 << endl;
  return 0;
}
