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.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.PriorityQueue;
import java.util.Set;
import java.util.StringTokenizer;
import static java.lang.Integer.parseInt;
import static java.lang.Long.parseLong;
import static java.lang.Double.parseDouble;

public class Solution { 
	
	
	
	
	public static void main(String[] args) throws IOException, InterruptedException {
		PrintWriter out=new PrintWriter(System.out); 
		BufferedReader br=new  BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st;
		int len=parseInt(br.readLine());
		int[] arr=new int[len];
		st=new StringTokenizer(br.readLine());
		int min=Integer.MAX_VALUE;
		for(int i=0;i<len;++i){
			arr[i]=parseInt(st.nextToken());
			if(arr[i]<min) min=arr[i];
		}
		//out.println(min);
		int distance=Integer.MAX_VALUE;
		int index=0;
		boolean found=false;
		for(int i=0;i<len;++i){
			if(arr[i]==min){
				if(found){
					if((i-index)<distance) distance=i-index;
					index=i;
				}else{
					index=i;
					found=true;
				}
			}
		}
		
		out.println(distance);
      				
				
		
		out.close();
		
	
	
	

	}
	
	static Integer[] Djikstra(Map<Integer,List<Edge>> list,int s,int n){
		Integer[] bestDist=new Integer[n];
		PriorityQueue<Node> q=new PriorityQueue<>();
	    q.add(new Node(0,s));
	    bestDist[s]=0;
	    while(!q.isEmpty()){
	    	Node node=q.poll();
	    	List<Edge> edges=list.get(node.index);
	    	if(edges!=null){
	    		if(bestDist[node.index]<node.dist) continue;
	    		for(Edge e:edges){
	    			int newdist=node.dist+e.weight;
	    			if(bestDist[e.to]==null || bestDist[e.to]>newdist){
	    				bestDist[e.to]=newdist;
	    				q.add(new Node(e.to,newdist));
	    			}
	    		}
	    	}
	    	
	    }
	    return bestDist;
	}
	
		
}

class Edge{
	int from,to,weight;
	public Edge(int f,int t,int w){
		from=f;
		to=t;
		weight=w;
	}
}

class Node implements Comparable<Node>{
	int dist;
	int index;
	public Node(int d,int i){
		dist=d;
		index=i;
	}
	@Override
	public int compareTo(Node node) {
		// TODO Auto-generated method stub
		return Integer.compare(dist, node.dist);
	}
}



