#include <bits/stdc++.h>
using namespace std;
bool desc(double a, double b) { return a > b; }
int main() {
  int n, i, f = 0, l, r, s = 0;
  cin >> n;
  int a[n];
  for (i = 0; i < n; i++) {
    cin >> a[i];
    if (a[i] != 0) f = 1;
  }
  if (f == 0) {
    cout << "NO";
    return 0;
  }
  l = 1;
  cout << "YES\n";
  vector<pair<int, int> > v;
  for (i = 0; i < n; i++) {
    s += a[i];
    if (s == 0 && a[i] != 0) {
      v.push_back({l, i});
      l = i + 1;
      i--;
    }
  }
  if (s != 0) {
    v.push_back({l, n});
  } else {
    v[v.size() - 1].second = n;
  }
  cout << v.size() << endl;
  for (i = 0; i < v.size(); i++)
    cout << v[i].first << " " << v[i].second << endl;
}
