#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, sum = 0, l = 0, r = 0;
  cin >> n;
  vector<int> v(n), ans;
  for (int i = 0; i < n; ++i) {
    cin >> v[i];
    sum += v[i];
    if (sum == 0 && v[i] != 0) {
      sum = v[i];
      r = i;
      ans.push_back(l + 1);
      ans.push_back(r);
      l = i;
    }
  }
  ans.push_back(l + 1);
  ans.push_back(n);
  if (all_of(v.begin(), v.end(), [](int k) { return k == 0; }))
    cout << "NO";
  else {
    cout << "YES\n";
    cout << ans.size() / 2 << '\n';
    for (std::vector<int>::iterator j = ans.begin(); j != ans.end(); j += 2) {
      cout << *j << " " << *(j + 1) << '\n';
    }
  }
}
