// 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; }
}
int index = (start + end) / 2;
for (int k = start;k < index;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+PiBhcnJbaV07Cgl9CglpbnQgaTsKCWZvciAoaSA9IDA7aSA8IG4tMTtpKyspIHsKCQlpZiAoYXJyW2ldID4gYXJyW2kgKyAxXSkgeyBzdGFydCA9IGk7IGJyZWFrOyB9Cgl9CglpbnQgajsKCWZvciAoaiA9IG4gLSAxO2ogPj0gMTtqLS0pIHsKCQlpZiAoYXJyW2pdIDwgYXJyW2ogLSAxXSkgeyBlbmQgPSBqOyBicmVhazsgfQoJfQoJCglpbnQgaW5kZXggPSAoc3RhcnQgKyBlbmQpIC8gMjsKCglmb3IgKGludCBrID0gc3RhcnQ7ayA8IGluZGV4O2srKykgewoJCXN3YXAoYXJyW2tdLCBhc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