function Main(input) {
	inputs = input.split("\n");
	input = inputs[1].split(" ").map(Number);
	ans = true;
	culc = 0;
	temp = 0;
	
	for(var i = 0; i < input.length - 1; i++){
		if(input[i + 1] < input[i]){
			if(culc == 0){
				temp = input[i];
				number = i;
				culc++;
			}else{
				input[number] = input[i + 1];
				input[i + 1] = temp;
			}
		}
	}
	
	for(var i = 0; i < input.length - 1; i++){
		if(!(input[i] < input[i + 1])){
			ans = false;
		}
	}
	
	if(ans){
		console.log("YES");
	}else{
		console.log("NO");
	}

}Main(require("fs").readFileSync("/dev/stdin", "utf8"));
