#include <bits/stdc++.h>
const long long maxx = 1e9 + 10;
using namespace std;
long long n, a[100005], minn = maxx, i, min2, vt;
int main() {
  cin >> n;
  for (i = 1; i <= n; ++i) {
    cin >> a[i];
    if (a[i] < minn) minn = a[i];
  }
  for (i = 1; i <= n; ++i)
    if (a[i] == minn) break;
  vt = i;
  min2 = n;
  for (i += 1; i <= n; ++i)
    if (a[i] == minn) {
      if (i - vt < min2) min2 = i - vt;
      vt = i;
    }
  cout << min2;
  return 0;
}
