#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long int n;
  cin >> n;
  vector<long long int> arr(n);
  for (long long int i = 0; i < n; ++i) {
    cin >> arr[i];
  }
  bool impossible = true;
  for (long long int i = 0; i < n; ++i) {
    if (arr[i]) impossible = false;
  }
  if (impossible) {
    cout << "NO" << endl;
    return 0;
  }
  vector<pair<long long int, long long int> > ans;
  long long int l = 0, i = 0;
  while (i < n) {
    while (arr[i] == 0) {
      i++;
      if (i == n) {
        i--;
        break;
      }
    }
    ans.push_back({l, i});
    i++;
    l = i;
  }
  cout << "YES\n";
  if (arr[ans[ans.size() - 1].second] == 0) {
    ans.erase(ans.end() - 1);
  }
  ans[ans.size() - 1].second = n - 1;
  cout << ans.size() << endl;
  for (long long int i = 0; i < ans.size(); ++i) {
    cout << ans[i].first + 1 << " " << ans[i].second + 1 << endl;
  }
}
