#include <bits/stdc++.h>
using namespace std;
vector<pair<long long, long long> > v;
int main() {
  long long n, i, x, s = 0;
  cin >> n;
  long long l = 1;
  for (i = 1; i <= n; i++) {
    cin >> x;
    if (x != 0 && s != 0) {
      v.push_back({l, i - 1});
      s = 0;
      l = i;
    }
    s = s + x;
  }
  if (s != 0) v.push_back({l, n}), l = n + 1;
  if (l != n + 1) {
    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';
}
