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 CPP):

Solution:
#include <bits/stdc++.h>
#pragma optimize("avx")
#pragma optimize("no-stack-protector")
namespace io {
inline char gnc() { return (char)getchar(); }
template <typename T>
inline void gi(T &dx) {
  dx = 0;
  int yc = gnc();
  bool nega = false;
  while (yc < '0' || yc > '9') {
    nega = (yc == '-' ? true : nega);
    yc = gnc();
  }
  while (yc >= '0' && yc <= '9') {
    dx = (T)(dx * 10 + yc - '0');
    yc = gnc();
  }
  if (nega) {
    dx = -dx;
  }
}
void gc(char &a) {
  do a = gnc();
  while (!isgraph(a));
}
void gss(char *c) {
  *c = gnc();
  while (!isgraph(*c)) *c = gnc();
  while (isgraph(*c)) *++c = gnc();
  *c = 0;
}
template <typename t1, typename t2>
inline void gi(t1 &a, t2 &b) {
  gi(a);
  gi(b);
}
template <typename t1, typename t2, typename t3>
inline void gi(t1 &a, t2 &b, t3 &c) {
  gi(a);
  gi(b);
  gi(c);
}
template <typename t1, typename t2, typename t3, typename t4>
inline void gi(t1 &a, t2 &b, t3 &c, t4 &d) {
  gi(a);
  gi(b);
  gi(c);
  gi(d);
}
template <typename t1, typename t2, typename t3, typename t4, typename t5>
inline void gi(t1 &a, t2 &b, t3 &c, t4 &d, t5 &e) {
  gi(a);
  gi(b);
  gi(c);
  gi(d);
  gi(e);
}
}  // namespace io
using namespace io;
using namespace std;
template <typename t1, typename t2>
inline int gcd(t1 x, t2 y) {
  return y > x ? gcd(y, x) : y ? gcd(y, x % y) : x;
}
template <typename t1, typename t2>
inline void exgcd(t1 a, t1 b, t2 &x, t2 &y) {
  if (!b) {
    x = 1;
    y = 0;
    return;
  }
  exgcd(b, a % b, x, y);
  int t = x;
  x = y;
  y = t - (a / b) * y;
}
const int INF = 0x3f3f3f3f;
const int MOD = 1e9 + 7;
const int Rev = (MOD + 1) >> 1;
template <typename T>
inline void Sol(T &x) {
  if (x >= MOD) x -= MOD;
}
template <typename T1, typename T2>
inline int inc(T1 x, T2 y) {
  x += y;
  if (x >= MOD) x -= MOD;
  return x;
}
template <typename T1, typename T2>
inline int dec(T1 x, T2 y) {
  x += MOD - y;
  if (x >= MOD) x -= MOD;
  return x;
}
template <typename T1, typename T2>
inline long long mul(T1 x, T2 y) {
  long long res = (long long)x * y;
  return res >= MOD ? res % MOD : res;
}
template <typename t1, typename t2, typename t3>
inline long long mul(t1 x, t2 y, t3 z) {
  return mul(mul(x, y), z);
}
template <typename t1, typename t2, typename t3, typename t4>
inline long long mul(t1 a, t2 b, t3 c, t4 d) {
  return mul(mul(a, b), mul(c, d));
}
inline long long qpow(long long x, int y) {
  long long res = 1;
  for (; y; y >>= 1, x = x * x % MOD)
    if (y & 1) res = res * x % MOD;
  return res;
}
inline long long myinv(long long x) { return qpow(x, MOD - 2); }
inline int read() {
  int x = 0, f = 1;
  char c = getchar();
  while (!isdigit(c)) {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (isdigit(c)) {
    x = x * 10 + c - '0';
    c = getchar();
  }
  return x * f;
}
template <typename T1, typename T2>
inline void Getmin(T1 &x, T2 y) {
  if (x > y) x = y;
}
template <typename T1, typename T2>
inline void Getmax(T1 &x, T2 y) {
  if (x < y) x = y;
}
const int maxn = 500 + 10;
int n, d[maxn];
struct node {
  int deg, id;
  node() {}
  inline bool operator<(const node &rhs) const { return deg > rhs.deg; }
} a[maxn];
vector<pair<int, int> > ans;
int main() {
  n = read();
  int all = 0;
  for (int i = 1; i <= n; i++) a[i].deg = read(), a[i].id = i, all += a[i].deg;
  if (all < (n - 1) * 2) return puts("NO"), 0;
  printf("YES ");
  sort(a + 1, a + 1 + n);
  int tag = n + 1;
  for (int i = 1; i <= n; i++)
    if (a[i].deg == 1) {
      tag = i;
      break;
    }
  if (tag == 1) {
    if (n == 1)
      return printf("0\n0"), 0;
    else if (n == 2)
      return printf("1\n%d\n%d %d\n", 1, 1, 2), 0;
    return 0;
  }
  if (tag == 2) {
    printf("%d\n", 1 + (n > 2));
    printf("%d\n", n - 1);
    for (int i = 2; i <= n; i++) printf("%d %d\n", a[i].id, a[1].id);
    return 0;
  }
  swap(a[tag - 1], a[2]);
  for (int i = 1; i < tag - 1; i++)
    ans.push_back(make_pair(i, i + 1)), --a[i].deg, --a[i + 1].deg;
  int len = tag - 1 - 1;
  for (int i = tag; i <= n; i++) {
    if (i == tag)
      ans.push_back(make_pair(i, 1)), --a[1].deg, ++len;
    else if (i == tag + 1) {
      if (a[tag - 1].deg) {
        ans.push_back(make_pair(tag - 1, i));
        --a[tag - 1].deg;
        ++len;
      } else {
        for (int j = 1; j < tag; j++)
          if (a[j].deg) {
            --a[j].deg;
            ans.push_back(make_pair(j, i));
            break;
          }
      }
    } else {
      for (int j = 1; j < tag; j++)
        if (a[j].deg) {
          --a[j].deg;
          ans.push_back(make_pair(j, i));
          break;
        }
    }
  }
  printf("%d\n%d\n", len, ans.size());
  for (pair<int, int> cur : ans)
    printf("%d %d\n", a[cur.first].id, a[cur.second].id);
  return 0;
}