#include <bits/stdc++.h>
using std::swap;
using std::vector;
void partition2(vector<int> &a, vector<int> &c, int l, int r, int &m1,
                int &m2) {
  int x = c[l];
  m1 = l;
  m2 = l;
  for (int i = l + 1; i <= r; i++) {
    if (c[i] == x) {
      m2++;
      swap(a[i], a[m2]);
      swap(c[i], c[m2]);
    } else if (c[i] > x) {
      m2++;
      swap(a[i], a[m2]);
      swap(a[m1], a[m2]);
      swap(c[i], c[m2]);
      swap(c[m1], c[m2]);
      m1++;
    }
  }
}
void randomized_quick_sort(vector<int> &a, vector<int> &c, int l, int r) {
  if (l >= r) {
    return;
  }
  int k = l + rand() % (r - l + 1);
  swap(a[l], a[k]);
  swap(c[l], c[k]);
  int m1, m2;
  partition2(a, c, l, r, m1, m2);
  randomized_quick_sort(a, c, l, m1 - 1);
  randomized_quick_sort(a, c, m2 + 1, r);
}
int main() {
  int n, n2;
  int i, j, l;
  int res = 0, tmp;
  std::cin >> n;
  vector<int> a(n);
  for (i = 0; i < n; i++) {
    std::cin >> a[i];
    if (a[i]) {
      res++;
      l = i;
    }
  }
  if (!res)
    std::cout << "NO";
  else {
    std::cout << "YES" << std::endl << res;
    for (j = 0, i = 0; i < n; i++) {
      if (a[i]) {
        if (i != l)
          std::cout << std::endl << j + 1 << ' ' << i + 1;
        else
          std::cout << std::endl << j + 1 << ' ' << n;
        j = i + 1;
      }
    }
  }
  return 0;
}
