function main(c){var b=c.split("\n");c=parseInt(b[0]);var d=[];b[1]=b[1].split(" ");for(var a=0;a<c;++a)d.push(parseInt(b[1][a],10));for(a=b=0;a<c;++a)d[a]!=a+1&&(b+=1);console.log(2>=b?"YES":"NO")}main(require("fs").readFileSync("/dev/stdin","utf8"));
