let n = Scanf.scanf " %d" (+) 0
let ps = Array.init n @@ fun _ -> Scanf.scanf " %d" (+) 0
let ps0 = Array.copy ps
let _ = Array.sort (-) ps0;
  if ps = ps0 then (print_endline "YES"; exit 0);
  for i = 0 to n - 1 do
    for j = i + 1 to n - 1 do
      let ps1 = Array.copy ps in
      ps1.(j) <- ps.(i); ps1.(i) <- ps.(j); if ps1 = ps0 then (print_endline "YES"; exit 0) done done;
  print_endline "NO"