import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int N = sc.nextInt();
		int[] p = new int[N];
		for(int i = 0; i < N; i++) p[i] = sc.nextInt();
		boolean check = true;
		for(int i = 1; i < N; i++) if(p[i - 1] >= p[i]) check = false;

		for(int i = 0; i < N; i++) {
			for(int j = i + 1; j < N; j++) {
				int tmp = p[i]; p[i] = p[j]; p[j] = tmp;
				boolean flg = true;
				for(int k = 1; k < N; k++) if(p[k - 1] >= p[k]) flg = false;
				check |= flg;
				tmp = p[i]; p[i] = p[j]; p[j] = tmp;
			}
		}
		System.out.println(check ? "YES" : "NO");
	}
} import java.util.Scanner; Scanner java.util public class Main{
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int N = sc.nextInt();
		int[] p = new int[N];
		for(int i = 0; i < N; i++) p[i] = sc.nextInt();
		boolean check = true;
		for(int i = 1; i < N; i++) if(p[i - 1] >= p[i]) check = false;

		for(int i = 0; i < N; i++) {
			for(int j = i + 1; j < N; j++) {
				int tmp = p[i]; p[i] = p[j]; p[j] = tmp;
				boolean flg = true;
				for(int k = 1; k < N; k++) if(p[k - 1] >= p[k]) flg = false;
				check |= flg;
				tmp = p[i]; p[i] = p[j]; p[j] = tmp;
			}
		}
		System.out.println(check ? "YES" : "NO");
	}
} Main public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int N = sc.nextInt();
		int[] p = new int[N];
		for(int i = 0; i < N; i++) p[i] = sc.nextInt();
		boolean check = true;
		for(int i = 1; i < N; i++) if(p[i - 1] >= p[i]) check = false;

		for(int i = 0; i < N; i++) {
			for(int j = i + 1; j < N; j++) {
				int tmp = p[i]; p[i] = p[j]; p[j] = tmp;
				boolean flg = true;
				for(int k = 1; k < N; k++) if(p[k - 1] >= p[k]) flg = false;
				check |= flg;
				tmp = p[i]; p[i] = p[j]; p[j] = tmp;
			}
		}
		System.out.println(check ? "YES" : "NO");
	} main {
		Scanner sc=new Scanner(System.in);
		int N = sc.nextInt();
		int[] p = new int[N];
		for(int i = 0; i < N; i++) p[i] = sc.nextInt();
		boolean check = true;
		for(int i = 1; i < N; i++) if(p[i - 1] >= p[i]) check = false;

		for(int i = 0; i < N; i++) {
			for(int j = i + 1; j < N; j++) {
				int tmp = p[i]; p[i] = p[j]; p[j] = tmp;
				boolean flg = true;
				for(int k = 1; k < N; k++) if(p[k - 1] >= p[k]) flg = false;
				check |= flg;
				tmp = p[i]; p[i] = p[j]; p[j] = tmp;
			}
		}
		System.out.println(check ? "YES" : "NO");
	} Scanner sc=new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int[] p = new int[N]; p new int[N] N for(int i = 0; i < N; i++) p[i] = sc.nextInt(); int i = 0; int i = 0; i 0 i < N i N i++ i++ i p[i] = sc.nextInt(); p[i] = sc.nextInt() p[i] p i sc.nextInt() sc.nextInt sc boolean check = true; check true for(int i = 1; i < N; i++) if(p[i - 1] >= p[i]) check = false; int i = 1; int i = 1; i 1 i < N i N i++ i++ i if(p[i - 1] >= p[i]) check = false; if(p[i - 1] >= p[i]) check = false; p[i - 1] >= p[i] p[i - 1] p i - 1 i 1 p[i] p i check = false check false for(int i = 0; i < N; i++) {
			for(int j = i + 1; j < N; j++) {
				int tmp = p[i]; p[i] = p[j]; p[j] = tmp;
				boolean flg = true;
				for(int k = 1; k < N; k++) if(p[k - 1] >= p[k]) flg = false;
				check |= flg;
				tmp = p[i]; p[i] = p[j]; p[j] = tmp;
			}
		} int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
			for(int j = i + 1; j < N; j++) {
				int tmp = p[i]; p[i] = p[j]; p[j] = tmp;
				boolean flg = true;
				for(int k = 1; k < N; k++) if(p[k - 1] >= p[k]) flg = false;
				check |= flg;
				tmp = p[i]; p[i] = p[j]; p[j] = tmp;
			}
		} {
			for(int j = i + 1; j < N; j++) {
				int tmp = p[i]; p[i] = p[j]; p[j] = tmp;
				boolean flg = true;
				for(int k = 1; k < N; k++) if(p[k - 1] >= p[k]) flg = false;
				check |= flg;
				tmp = p[i]; p[i] = p[j]; p[j] = tmp;
			}
		} for(int j = i + 1; j < N; j++) {
				int tmp = p[i]; p[i] = p[j]; p[j] = tmp;
				boolean flg = true;
				for(int k = 1; k < N; k++) if(p[k - 1] >= p[k]) flg = false;
				check |= flg;
				tmp = p[i]; p[i] = p[j]; p[j] = tmp;
			} int j = i + 1; int j = i + 1; j i + 1 i 1 j < N j N j++ j++ j {
				int tmp = p[i]; p[i] = p[j]; p[j] = tmp;
				boolean flg = true;
				for(int k = 1; k < N; k++) if(p[k - 1] >= p[k]) flg = false;
				check |= flg;
				tmp = p[i]; p[i] = p[j]; p[j] = tmp;
			} {
				int tmp = p[i]; p[i] = p[j]; p[j] = tmp;
				boolean flg = true;
				for(int k = 1; k < N; k++) if(p[k - 1] >= p[k]) flg = false;
				check |= flg;
				tmp = p[i]; p[i] = p[j]; p[j] = tmp;
			} int tmp = p[i]; tmp p[i] p i p[i] = p[j] p[i] p i p[j] p j p[j] = tmp p[j] p j tmp boolean flg = true; flg true for(int k = 1; k < N; k++) if(p[k - 1] >= p[k]) flg = false; int k = 1; int k = 1; k 1 k < N k N k++ k++ k if(p[k - 1] >= p[k]) flg = false; if(p[k - 1] >= p[k]) flg = false; p[k - 1] >= p[k] p[k - 1] p k - 1 k 1 p[k] p k flg = false flg false check |= flg check flg tmp = p[i] tmp p[i] p i p[i] = p[j] p[i] p i p[j] p j p[j] = tmp p[j] p j tmp System.out.println(check ? "YES" : "NO") System.out.println System.out System System.out check ? "YES" : "NO" check "YES" "NO" String[] args args public class Main{
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int N = sc.nextInt();
		int[] p = new int[N];
		for(int i = 0; i < N; i++) p[i] = sc.nextInt();
		boolean check = true;
		for(int i = 1; i < N; i++) if(p[i - 1] >= p[i]) check = false;

		for(int i = 0; i < N; i++) {
			for(int j = i + 1; j < N; j++) {
				int tmp = p[i]; p[i] = p[j]; p[j] = tmp;
				boolean flg = true;
				for(int k = 1; k < N; k++) if(p[k - 1] >= p[k]) flg = false;
				check |= flg;
				tmp = p[i]; p[i] = p[j]; p[j] = tmp;
			}
		}
		System.out.println(check ? "YES" : "NO");
	}
} public class Main{
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int N = sc.nextInt();
		int[] p = new int[N];
		for(int i = 0; i < N; i++) p[i] = sc.nextInt();
		boolean check = true;
		for(int i = 1; i < N; i++) if(p[i - 1] >= p[i]) check = false;

		for(int i = 0; i < N; i++) {
			for(int j = i + 1; j < N; j++) {
				int tmp = p[i]; p[i] = p[j]; p[j] = tmp;
				boolean flg = true;
				for(int k = 1; k < N; k++) if(p[k - 1] >= p[k]) flg = false;
				check |= flg;
				tmp = p[i]; p[i] = p[j]; p[j] = tmp;
			}
		}
		System.out.println(check ? "YES" : "NO");
	}
} Main
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int N = sc.nextInt();
		int[] p = new int[N];
		for(int i = 0; i < N; i++) p[i] = sc.nextInt();
		boolean check = true;
		for(int i = 1; i < N; i++) if(p[i - 1] >= p[i]) check = false;

		for(int i = 0; i < N; i++) {
			for(int j = i + 1; j < N; j++) {
				int tmp = p[i]; p[i] = p[j]; p[j] = tmp;
				boolean flg = true;
				for(int k = 1; k < N; k++) if(p[k - 1] >= p[k]) flg = false;
				check |= flg;
				tmp = p[i]; p[i] = p[j]; p[j] = tmp;
			}
		}
		System.out.println(check ? "YES" : "NO");
	}
}