#include <bits/stdc++.h>
int a[100050];
int main() {
  int n;
  while (~scanf("%d", &n)) {
    int minn = 1e9 + 7, p;
    for (int i = 1; i <= n; i++) {
      scanf("%d", &a[i]);
      if (a[i] < minn) {
        minn = a[i];
        p = i;
      }
    }
    int d = p, ans = 1e9 + 7;
    for (int i = p + 1; i <= n; i++) {
      if (a[i] == minn) {
        if (i - d < ans) {
          ans = i - d;
        }
        d = i;
      }
    }
    printf("%d\n", ans);
  }
}
