#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  vector<int> ranges;
  int first;
  cin >> first;
  bool isNull = (first == 0);
  for (int i = 1; i < N; i++) {
    int num;
    cin >> num;
    if (num == 0) continue;
    if (isNull) {
      isNull = false;
      continue;
    }
    isNull = false;
    ranges.push_back(i);
  }
  if (isNull) {
    cout << "NO" << endl;
    return 0;
  }
  ranges.push_back(N);
  cout << "YES" << endl << ranges.size() << endl;
  int j = 1;
  for (int r = 0; r < ranges.size(); r++) {
    cout << j << " " << ranges[r] << endl;
    j = ranges[r] + 1;
  }
  return 0;
}
