#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i, sum = 0, x = 1, y, p = 0, z;
  cin >> n;
  int a[n];
  vector<pair<int, int> > v;
  for (i = 0; i < n; i++) {
    cin >> a[i];
    z = sum;
    sum += a[i];
    if (sum == 0 && i != 0 && z != 0) {
      y = i;
      sum = a[i];
      v.push_back(make_pair(x, y));
      x = i + 1;
      p++;
    }
  }
  v.push_back(make_pair(x, n));
  if (sum == 0) {
    cout << "NO";
    return 0;
  }
  cout << "YES\n";
  cout << v.size() << "\n";
  for (i = 0; i < v.size(); i++) {
    cout << v[i].first << " " << v[i].second << "\n";
  }
}
