#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, i, j, k = 0;
  cin >> n;
  vector<int> a(n);
  vector<pair<int, int> > b;
  for (i = 0; i < n; i++) cin >> a[i];
  j = 0;
  for (i = 0; i < n; i++) {
    if (a[i] == 0 && b.size()) {
      b[b.size() - 1].second++;
    } else if (a[i] != 0) {
      b.push_back({i + 1, i + 1});
    } else if (a[i] == 0) {
      k = i;
      while (a[i] == 0 && i < n) i++;
      if (i == n)
        j = 1;
      else
        b.push_back({k + 1, i + 1});
    }
  }
  if (j)
    cout << "NO" << endl;
  else {
    cout << "YES" << endl << b.size() << endl;
    for (i = 0; i < b.size(); i++) {
      cout << b[i].first << " " << b[i].second << endl;
    }
  }
}
