Problem: Graph constructive problems are back! This time the graph you are asked to build should match the following properties.

The graph is connected if and only if there exists a path between every pair of vertices.

The diameter (aka "longest shortest path") of a connected undirected graph is the maximum number of edges in the shortest path between any pair of its vertices.

The degree of a vertex is the number of edges incident to it.

Given a sequence of n integers a_1, a_2, ..., a_n construct a connected undirected graph of n vertices such that:

  * the graph contains no self-loops and no multiple edges; 
  * the degree d_i of the i-th vertex doesn't exceed a_i (i.e. d_i ≤ a_i); 
  * the diameter of the graph is maximum possible. 



Output the resulting graph or report that no solution exists.

Input

The first line contains a single integer n (3 ≤ n ≤ 500) — the number of vertices in the graph.

The second line contains n integers a_1, a_2, ..., a_n (1 ≤ a_i ≤ n - 1) — the upper limits to vertex degrees.

Output

Print "NO" if no graph can be constructed under the given conditions.

Otherwise print "YES" and the diameter of the resulting graph in the first line.

The second line should contain a single integer m — the number of edges in the resulting graph.

The i-th of the next m lines should contain two integers v_i, u_i (1 ≤ v_i, u_i ≤ n, v_i ≠ u_i) — the description of the i-th edge. The graph should contain no multiple edges — for each pair (x, y) you output, you should output no more pairs (x, y) or (y, x).

Examples

Input


3
2 2 2


Output


YES 2
2
1 2
2 3


Input


5
1 4 1 1 1


Output


YES 2
4
1 2
3 2
4 2
5 2


Input


3
1 1 1


Output


NO

Note

Here are the graphs for the first two example cases. Both have diameter of 2.

<image> d_1 = 1 ≤ a_1 = 2

d_2 = 2 ≤ a_2 = 2

d_3 = 1 ≤ a_3 = 2 

<image> d_1 = 1 ≤ a_1 = 1

d_2 = 4 ≤ a_2 = 4

d_3 = 1 ≤ a_3 = 1

d_4 = 1 ≤ a_4 = 1 

Solution (in JAVA):

Solution:
import java.util.*;
import java.io.*;
public class Solution implements Runnable {
    FastScanner sc;
    PrintWriter pw;
    
    final class FastScanner {
        BufferedReader br;
        StringTokenizer st;
 
        public FastScanner() {
            try {
                br = new BufferedReader(new InputStreamReader(System.in));
                st = new StringTokenizer(br.readLine());
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
 
        public long nlo() {
            return Long.parseLong(next());
        }
 
        public String next() {
            if (st.hasMoreTokens()) return st.nextToken();
            try {
                st = new StringTokenizer(br.readLine());
            } catch (Exception e) {
                e.printStackTrace();
            }
            return st.nextToken();
        }
 
        public int ni() {
            return Integer.parseInt(next());
        }
 
        public String nli() {
            String line = "";
            if (st.hasMoreTokens()) line = st.nextToken();
            else try {
                return br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            while (st.hasMoreTokens()) line += " " + st.nextToken();
            return line;
        }
 
        public double nd() {
            return Double.parseDouble(next());
        }
    }
    public static void main(String[] args) throws Exception
    {
        new Thread(null,new Solution(),"codeforces",1<<28).start();
    }
    public void run()
    {
        sc=new FastScanner();
        pw=new PrintWriter(System.out);
        try{
        solve();}
        catch(Exception e)
        {
            pw.println(e);
        }
        pw.flush();
        pw.close();
    }
    public long gcd(long a,long b)
    {
        return b==0L?a:gcd(b,a%b);
    }
    public long ppow(long a,long b,long mod)
    {
        if(b==0L)
        return 1L;
        long tmp=1;
        while(b>1L)
        {
            if((b&1L)==1)
            tmp*=a;
            a*=a;
            a%=mod;
            tmp%=mod;
            b>>=1;
        }
        return (tmp*a)%mod;
    }
    public long pow(long a,long b)
    {
        if(b==0L)
        return 1L;
        long tmp=1;
        while(b>1L)
        {
            if((b&1L)==1)
            tmp*=a;
            a*=a;
            b>>=1;
        }
        return (tmp*a);
    }
    public  int gcd(int x,int y)
    {
        return y==0?x:gcd(y,x%y);
    }
   
    //////////////////////////////////
    /////////////  LOGIC  ///////////
    ////////////////////////////////
   public ArrayList<Integer>[] adj;
   public int[] visit;
   public int[] dist,ans;
    public void solve() throws Exception{
       int n=sc.ni();
       int[] arr=new int[n];
       StringBuilder str=new StringBuilder();
       int m = 0,d=0;
       ArrayList<Integer> list,list1;
       list=new ArrayList();
       list1=new ArrayList();
       for(int i=0;i<n;i++){
           arr[i]=sc.ni();
           if(arr[i]==1)
           list.add(i);
           else
           list1.add(i);
       }
       boolean res=true;
       if(list1.size()==0)
       res=false;
       else if(list1.size()==1){
        if(arr[list1.get(0)]<list.size()){
            res=false;
        }
        else{
            m=list.size();
            d=2;
            for(int x:list){
                int a=x+1;
                int b=list1.get(0)+1;
                str.append(a+" "+b+"\n");
            }
        }
       }
       else{
            m=list1.size()-1+list.size();
            d=list1.size()-1;
            for(int i=1;i<list1.size();i++){
                int a=list1.get(i)+1;
                int b=list1.get(i-1)+1;
                arr[a-1]--;arr[b-1]--;
                str.append(a+" "+b+"\n");
            }
            int p=0;
            if(p<list.size())
            {
                int a=list.get(p++)+1;
                int b=list1.get(0)+1;
                arr[b-1]--;
                str.append(a+" "+b+"\n");d++;
            }
            if(p<list.size())
            {
                int a=list.get(p++)+1;
                int b=list1.get(list1.size()-1)+1;
                arr[b-1]--;
                str.append(a+" "+b+"\n");d++;
            }
            HashSet<Integer> set=new HashSet();
            for(int x:list1)
                if(arr[x]>0)
                    set.add(x);
            
            for(int x:set){
                for(;p<list.size();p++){
                    if(arr[x]==0)
                    break;
                    int a=x+1;
                    int b=list.get(p)+1;
                    str.append(a+" "+b+"\n");
                    arr[x]--;
                }
            }
            if(p<list.size())
            res=false;
       }
       if(res){
           pw.println("YES "+d);
           pw.println(m+"\n"+str);
       }
       else
       pw.println("NO");
    }
}