#include <bits/stdc++.h>
using namespace std;
int main()
{
int n,j,pos = 1,cnt = 0;
cin >> n;
for(int i = 1;i <= n;i ++)
{
cin >> j;
if(pos == i)
{
if(pos == n)
{
cout << "YES" << endl << cnt << endl;
break;
}
pos += j;
cnt ++;
}
}
if(pos > n)
cout << "NO" << endl << cnt << endl;
return 0;
}