void main(){
  import std.stdio, std.string, std.conv, std.algorithm;
  import std.exception;

  int n; rd(n);
  auto a=readln.split.to!(int[]);

  auto mn=reduce!(min)(a);
  int[] ids;
  foreach(int i; 0..n){
    if(a[i]==mn) ids~=i;
  }
  int dist=n;
  foreach(i; 0..(ids.length-1)){
    dist=min(dist, ids[i+1]-ids[i]);
  }

  writeln(dist);
}

void rd(T...)(ref T x){
  import std.stdio, std.string, std.conv;
  auto l=readln.split;
  assert(l.length==x.length);
  foreach(i, ref e; x){
    e=l[i].to!(typeof(e));
  }
}
void wr(T...)(T x){
  import std.stdio;
  foreach(e; x) write(e, " ");
  writeln();
}