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.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author prakharjain
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        DMaximumDiameterGraph solver = new DMaximumDiameterGraph();
        solver.solve(1, in, out);
        out.close();
    }

    static class DMaximumDiameterGraph {
        public void solve(int testNumber, InputReader in, OutputWriter out) {
            int n = in.nextInt();

            //int[] a = in.nextIntArray(n);

            //Arrays.sort(a);

            ver[] a = new ver[n];
            for (int i = 0; i < n; i++) {
                a[i] = new ver(i, in.nextInt());
            }

            Arrays.sort(a, (v1, v2) -> v1.a - v2.a);

            a[0].a = 1;
            a[1].a = 1;

            int dsum = 0;

            for (int i = 0; i < n; i++) {
                dsum += a[i].a;
            }
            if (2 * n - 2 > dsum) {
                out.println("NO");
                return;
            }

            List[] g = new List[n];

            for (int i = 0; i < n; i++) {
                g[i] = new ArrayList();
            }

            //Set<Integer> ss = new HashSet<>();
            List<ver> ss = new ArrayList<>();
            List<Integer> ssl = new ArrayList<>();

            for (int i = 0; i < n; i++) {
                if (a[i].a > 1) {
                    ss.add(new ver(a[i]));
                } else {
                    ssl.add(a[i].i);
                }
            }

            if (ss.size() > 1) {
                for (int i = 0; i < ss.size(); i++) {
                    if (i == 0 || i == ss.size() - 1) {
                        ss.get(i).dec();
                    } else {
                        ss.get(i).dec();
                        ss.get(i).dec();
                    }
                }
            }

            for (int i = 0; i < ss.size() - 1; i++) {
                int c = ss.get(i).i;
                int ne = ss.get(i + 1).i;

                g[c].add(ne);
                g[ne].add(c);
            }

            int l = n - ss.size();
            int nl = n - l;

            int ans = 0;

            ans = (nl - 1) + 2;
            g[ss.get(0).i].add(ssl.get(0));
            g[ssl.get(0)].add(ss.get(0).i);

            ss.get(0).dec();

            g[ss.get(nl - 1).i].add(ssl.get(1));
            g[ssl.get(1)].add(ss.get(nl - 1).i);

            ss.get(nl - 1).dec();

            int j1 = 0;
            for (int i = 2; i < l; i++) {
                int li = ssl.get(i);
                while (ss.get(j1).a == 0) {
                    j1++;
                }

                g[ss.get(j1).i].add(li);
                g[li].add(ss.get(j1).i);

                ss.get(j1).dec();
            }

            out.println("YES " + ans);
            out.println(n - 1);
            for (int i = 0; i < n; i++) {
                for (int j = 0; j < g[i].size(); j++) {
                    int v = (int) g[i].get(j);
                    if (v > i) {
                        out.println((i + 1) + " " + (v + 1));
                    }
                }
            }
        }

        class ver {
            int i;
            int a;

            public ver(int i, int a) {
                this.i = i;
                this.a = a;
            }

            public ver(ver c) {
                this.i = c.i;
                this.a = c.a;
            }

            void dec() {
                this.a = this.a - 1;
            }

        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void print(Object... objects) {
            for (int i = 0; i < objects.length; i++) {
                if (i != 0) {
                    writer.print(' ');
                }
                writer.print(objects[i]);
            }
        }

        public void println(Object... objects) {
            print(objects);
            writer.println();
        }

        public void close() {
            writer.close();
        }

        public void println(int i) {
            writer.println(i);
        }

    }
}