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
import java.io.PrintWriter;

import java.util.*;
import java.util.Arrays ; 

 
import java.io.DataInputStream; 
import java.io.FileInputStream; 
import java.io.IOException; 
import java.lang.reflect.Array;


public class Test{
     static PrintWriter  pw = new PrintWriter(System.out); 
static class Reader 
    { 
    
        final private int BUFFER_SIZE = 1 << 16; 
        private DataInputStream din; 
        private byte[] buffer; 
        private int bufferPointer, bytesRead; 
  
        public Reader() 
        { 
            din = new DataInputStream(System.in); 
            buffer = new byte[BUFFER_SIZE]; 
            bufferPointer = bytesRead = 0; 
        } 
  
        public Reader(String file_name) throws IOException 
        { 
            din = new DataInputStream(new FileInputStream(file_name)); 
            buffer = new byte[BUFFER_SIZE]; 
            bufferPointer = bytesRead = 0; 
        } 
  
        public String readLine() throws IOException 
        { 
            byte[] buf = new byte[64]; // line length 
            int cnt = 0, c; 
            while ((c = read()) != -1) 
            { 
                if (c == '\n') 
                    break; 
                buf[cnt++] = (byte) c; 
            } 
            return new String(buf, 0, cnt); 
        } 
  
        public int nextInt() throws IOException 
        { 
            int ret = 0; 
            byte c = read(); 
            while (c <= ' ') 
                c = read(); 
            boolean neg = (c == '-'); 
            if (neg) 
                c = read(); 
            do
            { 
                ret = ret * 10 + c - '0'; 
            }  while ((c = read()) >= '0' && c <= '9'); 
  
            if (neg) 
                return -ret; 
            return ret; 
        } 
  
        public long nextLong() throws IOException 
        { 
            long ret = 0; 
            byte c = read(); 
            while (c <= ' ') 
                c = read(); 
            boolean neg = (c == '-'); 
            if (neg) 
                c = read(); 
            do { 
                ret = ret * 10 + c - '0'; 
            } 
            while ((c = read()) >= '0' && c <= '9'); 
            if (neg) 
                return -ret; 
            return ret; 
        } 
  
        public double nextDouble() throws IOException 
        { 
            double ret = 0, div = 1; 
            byte c = read(); 
            while (c <= ' ') 
                c = read(); 
            boolean neg = (c == '-'); 
            if (neg) 
                c = read(); 
  
            do { 
                ret = ret * 10 + c - '0'; 
            } 
            while ((c = read()) >= '0' && c <= '9'); 
  
            if (c == '.') 
            { 
                while ((c = read()) >= '0' && c <= '9') 
                { 
                    ret += (c - '0') / (div *= 10); 
                } 
            } 
  
            if (neg) 
                return -ret; 
            return ret; 
        } 
  
        private void fillBuffer() throws IOException 
        { 
            bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE); 
            if (bytesRead == -1) 
                buffer[0] = -1; 
        } 
  
        private byte read() throws IOException 
        { 
            if (bufferPointer == bytesRead) 
                fillBuffer(); 
            return buffer[bufferPointer++]; 
        } 
  
        public void close() throws IOException 
        { 
            if (din == null) 
                return; 
            din.close(); 
        } 
    } 
   

static int find(long x[],long r){
    int sum =0 ;
    
    for (int i = 0; i < x.length; i++) {
        if(x[i]==r) return i+1 ;
    }
    return sum ;
}
static int [] find2(int x[][],int temp,int y[]){
    for (int i = 0; i < x.length; i++) {
        int sum=0 ;
        for (int j = 0; j < x.length; j++) {
           sum+=x[j][i] ;
        }
        y[i]=sum ;
   
    }
   return y;
    
}
static void found(LinkedList<Long> r1 ,long star,long x[]){
    for (int i = 0; i < x.length; i++) {
        if(x[i]==star)r1.add((long)i+1) ;
    }
}
 static String db(String s){
     StringBuilder b= new StringBuilder(s) ;
     
     return s+(b.reverse().toString()) ; 
    
 }
 static String btw(String s,char c){
     StringBuilder b= new StringBuilder(s) ;
     
     return (s+c)+(b.reverse().toString()) ; 
    
 }

      
      
            


    public static void main(String[] args) throws IOException  {

    
        
    Reader  in =new Reader ();
  // Scanner  in =new Scanner (System.in);
   int t =in.nextInt() ; 
  long x[]=new long [t] ; 
  long z[]=new long [t] ; 
        for (int i = 0; i < t; i++) {
            x[i]=in.nextInt() ; 
            z[i]=x[i] ;
        }
        Arrays.sort(z) ; 
        long star=0 
                ;
        
        for (int i = 0; i < t-1; i++) {
           if(z[i]==z[i+1]){
               star =z[i] ;
               break ; 
               
           } 
        }
     
     
        long max =0 ;
        long fin =0 ;
        int q= 0 ;
        for (int i = 0; i < t; i++) {
            if(x[i]==star){
               q++ ;
                if(max<fin&&q>1){
                    fin= max ;
                }
                else{
              //  q ++ ;
                if(q==2){
                fin=max ;
                q=10 ;
                }
            }
                max=0 ;
            }
            max++ ;
        }
       
      
        pw.println(fin) ;

      pw.close(); 
      
            
             
        
      
}
static class pair{
   public  int val , key ; 
    pair(int val , int key){
        this.val= val ; 
        this .key = key   ; 
    }
}
}