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:
//package math_codet;

//Kuch ho naa ho, code sundar hona chahiye.............

import java.io.*;
import java.util.*;

public class lets_do {
    InputReader in;
    PrintWriter out;
    Helper_class h;
    final long mod = (long)1e9 + 7;
    final int MAXN = 1005;
    final int MAX_Ai = 100005;

    public static void main(String[] args) throws java.lang.Exception{
        new lets_do().run();
    }
    void run() throws Exception{
        in=new InputReader();
        out = new PrintWriter(System.out);
        h = new Helper_class();
        int t = 1;
        while(t-->0)
            solve();
        out.flush();
        out.close();
    }
    void solve(){
        int n = h.ni();
        int[] arr = new int[n + 1];
        int i = 0;
        int sum = 0;
        ArrayList<Integer> deg_1 = new ArrayList<Integer>();
        int max = 0, max_ind = -1, max_ind1 = -1, max1 = 0;
        for(i = 1; i <= n; i++){
            arr[i] = h.ni();
            if(arr[i] == 1){
                deg_1.add(i);
            }
            else
                sum += arr[i];
            if(arr[i] > max && arr[i] != 1){
                max = arr[i];
                max_ind = i;
            }
        }
        
        if(max_ind == -1){
            h.pn("NO");
            return;
        }
        int edges = 0;
        int deg = max - 1;
        int last = max_ind;
        StringBuffer str = new StringBuffer();
        int p = 0;
        int[] degree = new int[n + 1];
        int cnt = 0;
        if(p < deg_1.size() - 1)
        	cnt++;
        while(deg > 0 && p < deg_1.size() - 1){
            str.append(deg_1.get(p) +" " + max_ind).append("\n");
            p++;
            deg--;
            edges++;
            degree[max_ind]++;
        }

        for(i = 1; i <= n; i++){
            if(arr[i] > 1 && i != max_ind){
                cnt++;
                deg = arr[i] - 2;
                str.append(last +" " +i).append("\n");
                degree[last]++;
                edges++;
                while(deg > 0 && p < deg_1.size() - 1){
                    str.append(deg_1.get(p) +" " + i).append("\n");
                    edges++;
                    degree[i]++;
                    p++;
                    deg--;
                }
                last = i;
            }
        }

        if(p != deg_1.size()){
            str.append(deg_1.get(p) +" "+last).append("\n");
            p++;
            edges++;
            cnt++;
        }

        if(p != deg_1.size())
            h.pn("NO");
        else{
            h.pn("YES " + cnt);
            h.pn(edges);
            h.pn(str);
        }

    }
    static final Comparator<Pair> com=new Comparator<Pair>(){
        public int compare(Pair a, Pair b){
            int xx = Long.compare(a.d, b.d);
            if(xx == 0){
                int xxx = Long.compare(a.h, b.h);
                if(xxx == 0)
                    return Integer.compare(a.ind, b.ind);
                else
                    return xxx;
            }
            else
                return xx;
        }
    };
    class Pair{
        long d;
        long h;
        int ind;
        Pair(long p, long q, int i){
            d = p;
            h = q;
            ind = i;
        }
    }
    class Edge{
        int u , v;
        Edge(int a, int b){
            u = a;
            v = b;
        }
        int other(int x) {
            return u ^ v ^ x;
        }
    }
    class Vertex{
        int id;
        long f;
        Vertex parent;
        ArrayList<Vertex> children;
        ArrayList<Ticket> tickets;
        Vertex(int i){
            id = i;
            children = new ArrayList<>();
            tickets = new ArrayList<>();
        }
    }
    class Ticket{
        int k;
        long w;
        Ticket(int kk, long ww){
            k = kk;
            w = ww;
        }
    }
    class Helper_class{
        long gcd(long a, long b){return (b==0)?a:gcd(b,a%b);}
        int gcd(int a, int b){return (b==0)?a:gcd(b,a%b);}
        int bitcount(long n){return (n==0)?0:(1+bitcount(n&(n-1)));}
        void p(Object o){out.print(o);}
        void pn(Object o){out.println(o);}
        void pni(Object o){out.println(o);out.flush();}
        String n(){return in.next();}
        String nln(){return in.nextLine();}
        int ni(){return Integer.parseInt(in.next());}
        long nl(){return Long.parseLong(in.next());}
        double nd(){return Double.parseDouble(in.next());}

        long mul(long a,long b){
            if(a>=mod)a%=mod;
            if(b>=mod)b%=mod;
            a*=b;
            if(a>=mod)a%=mod;
            return a;
        }
        long modPow(long a, long p){
            long o = 1;
            while(p>0){
                if((p&1)==1)o = mul(o,a);
                a = mul(a,a);
                p>>=1;
            }
            return o;
        }
        long add(long a, long b){
            if(a>=mod)a%=mod;
            if(b>=mod)b%=mod;
            if(b<0)b+=mod;
            a+=b;
            if(a>=mod)a-=mod;
            return a;
        }
    }

    class InputReader{
        BufferedReader br;
        StringTokenizer st;
        public InputReader(){
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        public InputReader(String s) throws Exception{
            br = new BufferedReader(new FileReader(s));
        }

        String next(){
            while (st == null || !st.hasMoreElements()){
                try{
                    st = new StringTokenizer(br.readLine());
                }catch (IOException  e){
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        String nextLine(){
            String str = "";
            try{
                str = br.readLine();
            }catch (IOException e){
                e.printStackTrace();
            }
            return str;
        }
    }
}