#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int> > G;
int main() {
  int n;
  scanf("%d", &n);
  int sumcia = 0;
  int wynik = 1;
  int pocz, kon;
  pocz = 1;
  for (int i = 1; i <= n; i++) {
    int a;
    scanf("%d", &a);
    sumcia += a;
    if (sumcia == 0 and a == 0) {
      if (i == n) {
        printf("NO");
        return 0;
      }
    }
    if (sumcia == 0 and a != 0) {
      kon = i - 1;
      sumcia = a;
      wynik += 1;
      G.push_back(make_pair(pocz, kon));
      pocz = i;
    }
    kon = i;
  }
  G.push_back(make_pair(pocz, kon));
  printf("YES\n");
  printf("%d\n", wynik);
  for (int i = 0; i < G.size(); i++) {
    printf("%d %d\n", G[i].first, G[i].second);
  }
}
