// Sort The Array
#include<iostream>
#include<algorithm>
using namespace std;
long long arr[100005];
int main() {
int start = 0, end = 0;
int n;
cin >> n;
for (int i = 0;i < n;i++) {
cin >> arr[i];
}
int i;
for (i = 0;i < n-1;i++) {
if (arr[i] > arr[i + 1]) { start = i; break; }
}
int j;
for (j = n - 1;j >= 1;j--) {
if (arr[j] < arr[j - 1]) { end = j; break; }
}
for (int k = start;k < end;k++) {
swap(arr[k], arr[n - k - 1]);
}
bool sorted = true;
for (int i = 0; i < n; i++) {
if (arr[i] > arr[i + 1]) {
sorted = false;
break;
}
}
if (sorted) {
cout << "yes" << endl;
if (arr[start] > arr[end]) {
cout << arr[end] << " " << arr[start] << endl;
}
else {
cout << arr[start] << " " << arr[end] << endl;
}
}
else {
cout << "no" << endl;
}
return 0;
}
Ly8gU29ydCBUaGUgQXJyYXkKI2luY2x1ZGU8aW9zdHJlYW0+CiNpbmNsdWRlPGFsZ29yaXRobT4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCmxvbmcgbG9uZyBhcnJbMTAwMDA1XTsKCmludCBtYWluKCkgewoKCWludCBzdGFydCA9IDAsIGVuZCA9IDA7CglpbnQgbjsKCWNpbiA+PiBuOwoKCWZvciAoaW50IGkgPSAwO2kgPCBuO2krKykgewoJCWNpbiA+PiBhcnJbaV07Cgl9CglpbnQgaTsKCWZvciAoaSA9IDA7aSA8IG4tMTtpKyspIHsKCQlpZiAoYXJyW2ldID4gYXJyW2kgKyAxXSkgeyBzdGFydCA9IGk7IGJyZWFrOyB9Cgl9CglpbnQgajsKCWZvciAoaiA9IG4gLSAxO2ogPj0gMTtqLS0pIHsKCQlpZiAoYXJyW2pdIDwgYXJyW2ogLSAxXSkgeyBlbmQgPSBqOyBicmVhazsgfQoJfQoJCglmb3IgKGludCBrID0gc3RhcnQ7ayA8IGVuZDtrKyspIHsKCQlzd2FwKGFycltrXSwgYXJyW24gLSBrIC0gMV0pOwoJfQoKCglib29sIHNvcnRlZCA9IHRydWU7Cglmb3Ig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