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.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException; 
import java.io.InputStreamReader; 
import java.util.Scanner; 
import java.util.StringTokenizer; 
import java.util.*;
import java.io.*;
public class codeforces 
{ 
   static class Student{
       int x,y;//z;
        Student(int x,int y){
            this.x=x;
            this.y=y;
            //this.z=z;
        }
    }
    static int prime[];
    static void sieveOfEratosthenes(int n) 
    { 
        // Create a boolean array "prime[0..n]" and initialize 
        // all entries it as true. A value in prime[i] will 
        // finally be false if i is Not a prime, else true. 
        int pos=0;
        prime= new int[n+1]; 
        for(int p = 2; p*p <=n; p++) 
        { 
            // If prime[p] is not changed, then it is a prime 
            if(prime[p] == 0)
            { 
                // Update all multiples of p
                prime[p]=p;
                for(int i = p*p; i <= n; i += p)
                    if(prime[i]==0)
                    prime[i] = p; 
            } 
        } 
    }
/*static    class Sortbyroll implements Comparator<Student> 
{ 
    // Used for sorting in ascending order of 
    // roll number 
    public long compare(Student c, Student b) 
    {
        return c.x-b.x;
    } 
} */
static class FastReader 
    { 
        BufferedReader br; 
        StringTokenizer st; 
  
        public FastReader() 
        { 
            br = new BufferedReader(new
                     InputStreamReader(System.in)); 
        } 
  
        String next() 
        { 
            while (st == null || !st.hasMoreElements()) 
            { 
                try
                { 
                    st = new StringTokenizer(br.readLine()); 
                } 
                catch (IOException  e) 
                { 
                    e.printStackTrace(); 
                } 
            } 
            return st.nextToken(); 
        } 
  
        int nextInt() 
        { 
            return Integer.parseInt(next()); 
        } 
  
        long nextLong() 
        { 
            return Long.parseLong(next()); 
        } 
  
        double nextDouble() 
        { 
            return Double.parseDouble(next()); 
        } 
  
        String nextLine() 
        { 
            String str = ""; 
            try
            { 
                str = br.readLine(); 
            } 
            catch (IOException e) 
            { 
                e.printStackTrace(); 
            } 
            return str; 
        } 
    } 
 
    static class Edge{
        int a,b;
        Edge(int a,int b){
            this.a=a;
            this.b=b;
        }
    }
    static class Trie{
        HashMap<Character,Trie>map;
         int c;
        Trie(){
            map=new HashMap<>();
            //z=null;
            //o=null;
            c=0;
        }
    }
    //static long ans;
    static int parent[];
    static int rank[];
    static int b[];
    static int h[];
    static int ho[][];
    static int seg[];
    //static int pos;
    //static long mod=1000000000+7;
    //static int dp[][];
    static HashMap<String,Integer>map;
    static PriorityQueue<Student>q=new PriorityQueue<>();
    //static Stack<Integer>st;
   // static ArrayList<Character>ans;
    static ArrayList<ArrayList<Integer>>adj;
    //static ArrayList<ArrayList<Integer>>tr;
    static ArrayList<HashMap<Long,Student>>map1;
    static ArrayList<HashMap<Long,Long>>map2;
    //static long ans;
    static int pos;
    static Trie root;
    static long fac[];
    static int s,d;
    static int gw,gb;
    static long mod=(long)(998244353);
    static long ans1;
    static long ans2;
    static void solve()throws IOException{
        FastReader sc=new FastReader();
        int n,i,c=0,pos=0,tc,ans=0,x=0;
        n=sc.nextInt();
        int a[]=new int[n];
        for(i=0;i<n;i++)
            a[i]=sc.nextInt();
        ArrayList<Student>arr=new ArrayList<>();
        ArrayList<Student>a1=new ArrayList<>();
        for(i=0;i<n;i++){
            if(a[i]>1)
                arr.add(new Student(a[i],i+1));
            else{
                ++c;
                a1.add(new Student(a[i],i+1));
            }
        }
        if(arr.size()==0)
            pos=1;
        StringBuilder sb=new StringBuilder();
        tc=c;
        if(arr.size()!=0){
            ans=arr.size()-1;
            for(i=0;i<arr.size()-1;i++){
                ++x;
                sb.append((arr.get(i).y)+" "+(arr.get(i+1).y)+"\n");
                arr.get(i+1).x=arr.get(i+1).x-1;
                arr.get(i).x=arr.get(i).x-1;
            }
            if(c>0){
                ++x;
            ans=arr.size();
            arr.get(0).x=arr.get(0).x-1;
            //--c;
            sb.append(a1.get(c-1).y+" "+(arr.get(0).y)+"\n");
            --c;
            }
            if(c>=1){
                if(arr.get(arr.size()-1).x<1){
                    pos=1;
                  //  System.out.println("1st");
                }
                else{
                    ++x;
                    ans+=1;
                    sb.append(a1.get(c-1).y+" "+arr.get(arr.size()-1).y+"\n");
                     arr.get(arr.size()-1).x=arr.get(arr.size()-1).x-1;
                    --c;
                }
            }
            while(c>=1){
                ++x;
                for(i=0;i<arr.size();i++){
                    if(arr.get(i).x>=1)
                        break;
                }
                if(i>=arr.size()){
                   // System.out.println("1st");
                    pos=1;
                    break;
                }
                arr.get(i).x=arr.get(i).x-1;
                sb.append(a1.get(c-1).y+" "+arr.get(i).y+"\n");
                --c;
            }
        }
        if(pos==1)
            System.out.println("NO");
        else{
            System.out.println("YES"+" "+ans);
            System.out.println(x);
            System.out.println(sb.toString());
        }
    }

    static void dfs2(int p,int c,long dp1[][],long dp[]){
        for(Integer x: adj.get(c)){
            if(x==p)
                continue;
            dfs2(c,x,dp1,dp);
            dp[c]=Math.max(dp[c],dp[x]);
            if(dp1[c][0]==Long.MIN_VALUE)
                dp1[c][0]=dp[x];
            else if(dp1[c][0]<=dp[x]){
                dp1[c][1]=dp1[c][0];
                dp1[c][0]=dp[x];
            }
            else
                dp1[c][1]=Math.max(dp1[c][1],dp[x]);
        }
    }
    static void dfs(int p,int c,int a[],long dp[]){
        dp[c]=a[c];
        for(Integer x: adj.get(c)){
            if(x==p)
                continue;
            dfs(c,x,a,dp);
            dp[c]+=dp[x];
        }
    }
    static void dfs(int x,int y,char f[][],int n,int m){
        f[x][y]='u';
        if(x+1<n){
            if(f[x+1][y]=='*')
                ++pos;
            if(f[x+1][y]=='.')
                dfs(x+1,y,f,n,m);
        }
        if(x-1>=0){
            if(f[x-1][y]=='*')
                ++pos;
            if(f[x-1][y]=='.')
                dfs(x-1,y,f,n,m);
        }
        if(y+1<m){
            if(f[x][y+1]=='*')
                ++pos;
            if(f[x][y+1]=='.')
                dfs(x,y+1,f,n,m);
        }
        if(y-1>=0){
            if(f[x][y-1]=='*')
                ++pos;
            if(f[x][y-1]=='.')
                dfs(x,y-1,f,n,m);
        }
    }
    static void fill(int x,int y,char f[][],int dp[][],int n,int m){
        dp[x][y]=pos;
        f[x][y]='*';
           if(x+1<n){
            if(f[x+1][y]=='u')
                fill(x+1,y,f,dp,n,m);
        }
        if(x-1>=0){
            if(f[x-1][y]=='u')
                fill(x-1,y,f,dp,n,m);
        }
        if(y+1<m){
            if(f[x][y+1]=='u')
                fill(x,y+1,f,dp,n,m);
        }
        if(y-1>=0){
            if(f[x][y-1]=='u')
                fill(x,y-1,f,dp,n,m);
        }
    }
    static boolean check(String s){
        int i=0,j=s.length()-1;
        while(i<j){
            if(s.charAt(i)!=s.charAt(j))
                return false;
            ++i;
            --j;
        }
        return true;
    }
    static void update(int s,int e,int l,int r,int in,int v){
        if(s>e||s>r||l>e)
            return;
        if(s>=l&&e<=r){
            seg[in]=v;
            return;
        }
        int mid=(s+e)/2;
        update(s,mid,l,r,2*in+1,v);
        update(mid+1,e,l,r,2*in+2,v);
        seg[in]=Math.max(seg[2*in+1],seg[2*in+2]);
    }
        static int query(int s,int e,int l,int r,int in){
        if(s>e||s>r||l>e)
            return 0;
        if(s>=l&&e<=r){
            return seg[in];
            
        }
        int mid=(s+e)/2;
        return Math.max(query(s,mid,l,r,2*in+1),
        query(mid+1,e,l,r,2*in+2));
        //seg[in]=Math.max(seg[2*in+1],seg[2*in+2]);
    }
    static double dist(long x,long y,long z,long w){
        return Math.sqrt((x-y)*(x-y)+(z-w)*(z-w));
    }
    static void add(int x,int y,Queue<Integer>q,Queue<Integer>v,int b[][]){
        q.add(x);
        v.add(y);
        b[x][y]=1;
    }
    static long nCr(long n, long r, 
                                    long p) 
    { 
        return (fac[(int)n]* modInverse(fac[(int)r], p) 
                % p * modInverse(fac[(int)(n-r)], p) 
                                    % p) % p; 
    } 
    //static int prime[];
    //static int dp[];
    public static void main(String[] args){
        //long sum=0;
        try {
                codeforces.solve();
                } catch (Exception e) {
                    e.printStackTrace();
                }
    }
       static long modInverse(long n, long p) 
    { 
        return power(n, p-(long)2,p); 
    } 
 static long power(long x, long y, long p) 
{ 
    long res = 1;      // Initialize result 
  
    x = x % p;  // Update x if it is more than or  
                // equal to p 
  
    while (y > 0) 
    { 
        // If y is odd, multiply x with result 
        if (y %(long)2!=0) 
            res = (res*x) % p; 
  
        // y must be even now 
        y = y>>1; // y = y/2 
        x = (x*x) % p;   
    } 
    return res%p;
 }
    /*public static long power(long x,long a) {
		if(a==0) return 1;
		if(a%2==1)return (x*1L*power(x,a-1))%mod;
		return (power((int)((x*1L*x)%mod),a/2))%mod;
	}*/
   static int find(int x) 
    { 
        // Finds the representative of the set 
        // that x is an element of 
        while(parent[x]!=x) 
        { 
            // if x is not the parent of itself 
            // Then x is not the representative of 
            // his set,
            x=parent[x];
  
            // so we recursively call Find on its parent 
            // and move i's node directly under the 
            // representative of this set 
        } 
  
        return x; 
    }
    static void union(int x, int y) 
    { 
        // Find representatives of two sets 
        int xRoot = find(x), yRoot = find(y); 
  
        // Elements are in the same set, no need 
        // to unite anything. 
        if (xRoot == yRoot) 
            return; 
  
         // If x's rank is less than y's rank 
        if (rank[xRoot] < rank[yRoot]) 
  
            // Then move x under y  so that depth 
            // of tree remains less 
            parent[xRoot] = yRoot; 
  
        // Else if y's rank is less than x's rank 
        else if (rank[yRoot] < rank[xRoot]) 
  
            // Then move y under x so that depth of 
            // tree remains less 
            parent[yRoot] = xRoot; 
  
        else // if ranks are the same 
        { 
            // Then move y under x (doesn't matter 
            // which one goes where) 
            parent[yRoot] = xRoot; 
  
            // And increment the the result tree's 
            // rank by 1 
            rank[xRoot] = rank[xRoot] + 1; 
        } 
    } 
    static long gcd(long a, long b) 
    { 
        if (a == 0){ 
             //ans+=b;
            return b;
        }
        return gcd(b % a, a); 
    }
}