#include<bits/stdc++.h>
#define ll long long
#define endl '\n'
#define en cout<<endl;
#define f first
#define s second
#define bg begin()
#define e end()
#define all(a) (a).begin(), (a).end()
#define sz(a) (int)(a).size()
#define pb push_back
#define mp make_pair
#define forn for(int i=0;i<n;i++)
#define form for(int i=0;i<m;i++)
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
using namespace std;
const ll MOD=1e9+7;
bool isPrime(ll n){
if(n<=1)return 0;
int f=0;
for(int i=1;i<=sqrt(n)&&f<=2;i++){
if(n%i==0)f++;
}
return f<2;
}
void solve(){
int n,ntz=0;
cin>>n;
int arr[n];
forn{
cin>>arr[i];
ntz+=(arr[i]!=0);
}
vector<pair<int,int>>v;
int l=0;bool have=0;
for(int i=0;i<n;i++){
if(arr[i]!=0)have=1;
if(have&&(i==n-1||arr[i+1]!=0)){
v.push_back({l+1,i+1});
l=i+1;
have=0;
}
}
if(v.size()){
cout<<"YES";en
cout<<v.size();en
for(int i=0;i<v.size();i++)cout<<v[i].f<<" "<<v[i].s<<"\n";
return;
}
cout<<"NO";
}
int main(){
// fast;
int t = 1;
// cin>>t;
for (int i = 1; i <= t; ++i){
//cout<<"Case "<<i<<": ";
solve();
if (i != t) cout<<'\n';
}
}
/*
cout<<INT_MAX<<LLONG_MIN;
*/
235A - LCM Challenge | 1075B - Taxi drivers and Lyft |
1562A - The Miracle and the Sleeper | 1216A - Prefixes |
1490C - Sum of Cubes | 868A - Bark to Unlock |
873B - Balanced Substring | 1401D - Maximum Distributed Tree |
1716C - Robot in a Hallway | 1688B - Patchouli's Magical Talisman |
99A - Help Far Away Kingdom | 622B - The Time |
1688C - Manipulating History | 1169D - Good Triple |
1675B - Make It Increasing | 588A - Duff and Meat |
1541B - Pleasant Pairs | 1626B - Minor Reduction |
1680A - Minimums and Maximums | 1713A - Traveling Salesman Problem |
1713B - Optimal Reduction | 1710A - Color the Picture |
1686B - Odd Subarrays | 251A - Points on Line |
427C - Checkposts | 1159A - A pile of stones |
508A - Pasha and Pixels | 912A - Tricky Alchemy |
1249A - Yet Another Dividing into Teams | 1713C - Build Permutation |