Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests.
If you've seen these problems, a virtual contest is not for you - solve these problems in the archive.
If you just want to solve some problem from a contest, a virtual contest is not for you - solve this problem in the archive.
Never use someone else's code, read the tutorials or communicate with other person during a virtual contest.

No tag edit access

A. Nearest Minimums

time limit per test

2 secondsmemory limit per test

256 megabytesinput

standard inputoutput

standard outputYou are given an array of *n* integer numbers *a* _{0}, *a* _{1}, ..., *a* _{ n - 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* ≤ 10^{5}) — size of the given array. The second line contains *n* integers *a* _{0}, *a* _{1}, ..., *a* _{ n - 1} (1 ≤ *a* _{ i} ≤ 10^{9}) — 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

Codeforces (c) Copyright 2010-2020 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Aug/06/2020 05:22:58 (g1).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|