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>
using namespace std;
using ll = long long;
using ld = long double;
template <typename T>
inline T LCM(T a, T b) {
  return (a * b) / GCD(a, b);
}
template <typename T>
inline T GCD(T a, T b) {
  ll t;
  while (a) {
    t = a;
    a = b % a;
    b = t;
  }
  return b;
}
template <typename T>
inline string toString(T a) {
  return to_string(a);
}
template <typename T>
inline void toInt(string s, T &x) {
  stringstream str(s);
  str >> x;
}
inline ll add(ll x, ll y) {
  x += y;
  if (x >= 1000000007) x -= 1000000007;
  return x;
}
inline ll sub(ll x, ll y) {
  x -= y;
  if (x < 0) x += 1000000007;
  return x;
}
inline ll mul(ll x, ll y) {
  return ((x % 1000000007) * (y % 1000000007)) % 1000000007;
}
inline ll powr(ll a, ll b) {
  ll x = 1LL;
  while (b) {
    if (b & 1) x = mul(x, a);
    a = mul(a, a);
    b >>= 1;
  }
  return x;
}
inline ll inv(ll a) { return powr(a, 1000000007 - 2); }
const int inv2 = (1000000007 + 1) >> 1;
const ll INF = 999999999999999999;
const int inf = 999999999;
bool check(ll n) {
  if (n == 1) return 0;
  if (n == 2 or n == 3) return 1;
  if (n % 2 == 0 or n % 3 == 0) return 0;
  for (ll i = 5; i * i <= n; i += 6)
    if (n % i == 0 or n % (i + 2) == 0) return 0;
  return 1;
}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(NULL);
  int n;
  cin >> n;
  vector<pair<int, int> > one;
  vector<pair<int, int> > a;
  for (ll i = 0; i < n; i++) {
    int x;
    cin >> x;
    if (x == 1) {
      one.push_back({x, i + 1});
    } else {
      a.push_back({x, i + 1});
    }
  }
  if (a.size() == 0) {
    cout << "NO";
    return 0;
  }
  sort(a.begin(), a.end(), greater<pair<int, int> >());
  vector<int> v[n + 1];
  int prev = 0;
  int in = 0;
  bool flag = 0;
  int cnt = 0;
  int d = 0;
  int d2 = 0;
  for (int i = 0; i < a.size(); i++) {
    if (i == 0) {
      pair<int, int> p = a[i];
      prev = p.second;
      cnt++;
      for (int j = 0; j < p.first - (a.size() > 1); j++) {
        if (in < one.size()) {
          if (in == 0) {
            d++;
          }
          if (in == 1) {
            d2 = d + 1;
          }
          v[p.second].push_back(one[in].second);
          cnt++;
          in++;
          if (in == 2) {
            flag = 1;
          }
        }
      }
    } else if (i < a.size() - 1) {
      pair<int, int> p = a[i];
      v[prev].push_back(p.second);
      prev = p.second;
      d++;
      cnt++;
      for (int j = 0; j < p.first - 2; j++) {
        if (in < one.size()) {
          cnt++;
          v[p.second].push_back(one[in].second);
          in++;
        }
      }
    } else {
      pair<int, int> p = a[i];
      v[prev].push_back(p.second);
      prev = p.second;
      cnt++;
      d++;
      if (in >= one.size() and flag) {
        pair<int, int> p1 = a[0];
        d++;
        int a1 = v[p1.second][v[p1.second].size() - 2];
        v[p1.second][v[p1.second].size() - 2] = -1;
        v[p.second].push_back(a1);
      } else {
        bool f1 = 0;
        for (int j = 0; j < p.first - 1; j++) {
          if (in < one.size()) {
            if (f1 == 0) {
              d++;
              f1 = 1;
            }
            cnt++;
            v[p.second].push_back(one[in].second);
            in++;
          }
        }
      }
    }
  }
  if (cnt == n) {
    cout << "YES " << max(d2, d), cout << "\n";
    vector<pair<int, int> > edges;
    for (int i = 1; i <= n; i++) {
      for (auto x : v[i]) {
        if (x > 0) edges.push_back({min(x, i), max(x, i)});
      }
    }
    cout << edges.size(), cout << "\n";
    sort(edges.begin(), edges.end());
    for (auto x : edges) {
      cout << x.first << " " << x.second, cout << "\n";
    }
  } else {
    cout << "NO";
  }
  return 0;
}