import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int N = sc.nextInt();
		
		int[] map = new int[N];
		for (int i = 0; i < N; i++) {
			map[i] = sc.nextInt();
		}
		
		if (check(map)) {
			System.out.println("YES");
			return;
		}
		
		for (int i = 0; i < map.length-1; i++) {
			for (int j = i+1; j < map.length; j++) {
				
				int tmp = map[i];
				map[i] = map[j];
				map[j] = tmp;
				
				if (check(map)) {
					System.out.println("YES");
					return;
				}
				
				map[j] = map[i];
				map[i] = tmp;
				
			}
		}
	
		System.out.println("NO");
	}
	
	static boolean check(int[] map) {
		int pre = 0;
		for (int i : map) {
			if (pre > i) {
				return false;
			}
			pre = i;
		}
		return true;
	}
	
}
 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[] map = new int[N];
		for (int i = 0; i < N; i++) {
			map[i] = sc.nextInt();
		}
		
		if (check(map)) {
			System.out.println("YES");
			return;
		}
		
		for (int i = 0; i < map.length-1; i++) {
			for (int j = i+1; j < map.length; j++) {
				
				int tmp = map[i];
				map[i] = map[j];
				map[j] = tmp;
				
				if (check(map)) {
					System.out.println("YES");
					return;
				}
				
				map[j] = map[i];
				map[i] = tmp;
				
			}
		}
	
		System.out.println("NO");
	}
	
	static boolean check(int[] map) {
		int pre = 0;
		for (int i : map) {
			if (pre > i) {
				return false;
			}
			pre = i;
		}
		return true;
	}
	
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int N = sc.nextInt();
		
		int[] map = new int[N];
		for (int i = 0; i < N; i++) {
			map[i] = sc.nextInt();
		}
		
		if (check(map)) {
			System.out.println("YES");
			return;
		}
		
		for (int i = 0; i < map.length-1; i++) {
			for (int j = i+1; j < map.length; j++) {
				
				int tmp = map[i];
				map[i] = map[j];
				map[j] = tmp;
				
				if (check(map)) {
					System.out.println("YES");
					return;
				}
				
				map[j] = map[i];
				map[i] = tmp;
				
			}
		}
	
		System.out.println("NO");
	} main {
		Scanner sc = new Scanner(System.in);
		
		int N = sc.nextInt();
		
		int[] map = new int[N];
		for (int i = 0; i < N; i++) {
			map[i] = sc.nextInt();
		}
		
		if (check(map)) {
			System.out.println("YES");
			return;
		}
		
		for (int i = 0; i < map.length-1; i++) {
			for (int j = i+1; j < map.length; j++) {
				
				int tmp = map[i];
				map[i] = map[j];
				map[j] = tmp;
				
				if (check(map)) {
					System.out.println("YES");
					return;
				}
				
				map[j] = map[i];
				map[i] = tmp;
				
			}
		}
	
		System.out.println("NO");
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int[] map = new int[N]; map new int[N] N for (int i = 0; i < N; i++) {
			map[i] = sc.nextInt();
		} int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
			map[i] = sc.nextInt();
		} {
			map[i] = sc.nextInt();
		} map[i] = sc.nextInt() map[i] map i sc.nextInt() sc.nextInt sc if (check(map)) {
			System.out.println("YES");
			return;
		} check(map) check map {
			System.out.println("YES");
			return;
		} System.out.println("YES") System.out.println System.out System System.out "YES" return; for (int i = 0; i < map.length-1; i++) {
			for (int j = i+1; j < map.length; j++) {
				
				int tmp = map[i];
				map[i] = map[j];
				map[j] = tmp;
				
				if (check(map)) {
					System.out.println("YES");
					return;
				}
				
				map[j] = map[i];
				map[i] = tmp;
				
			}
		} int i = 0; int i = 0; i 0 i < map.length-1 i map.length-1 map.length map map.length 1 i++ i++ i {
			for (int j = i+1; j < map.length; j++) {
				
				int tmp = map[i];
				map[i] = map[j];
				map[j] = tmp;
				
				if (check(map)) {
					System.out.println("YES");
					return;
				}
				
				map[j] = map[i];
				map[i] = tmp;
				
			}
		} {
			for (int j = i+1; j < map.length; j++) {
				
				int tmp = map[i];
				map[i] = map[j];
				map[j] = tmp;
				
				if (check(map)) {
					System.out.println("YES");
					return;
				}
				
				map[j] = map[i];
				map[i] = tmp;
				
			}
		} for (int j = i+1; j < map.length; j++) {
				
				int tmp = map[i];
				map[i] = map[j];
				map[j] = tmp;
				
				if (check(map)) {
					System.out.println("YES");
					return;
				}
				
				map[j] = map[i];
				map[i] = tmp;
				
			} int j = i+1; int j = i+1; j i+1 i 1 j < map.length j map.length map map.length j++ j++ j {
				
				int tmp = map[i];
				map[i] = map[j];
				map[j] = tmp;
				
				if (check(map)) {
					System.out.println("YES");
					return;
				}
				
				map[j] = map[i];
				map[i] = tmp;
				
			} {
				
				int tmp = map[i];
				map[i] = map[j];
				map[j] = tmp;
				
				if (check(map)) {
					System.out.println("YES");
					return;
				}
				
				map[j] = map[i];
				map[i] = tmp;
				
			} int tmp = map[i]; tmp map[i] map i map[i] = map[j] map[i] map i map[j] map j map[j] = tmp map[j] map j tmp if (check(map)) {
					System.out.println("YES");
					return;
				} check(map) check map {
					System.out.println("YES");
					return;
				} System.out.println("YES") System.out.println System.out System System.out "YES" return; map[j] = map[i] map[j] map j map[i] map i map[i] = tmp map[i] map i tmp System.out.println("NO") System.out.println System.out System System.out "NO" String[] args args static boolean check(int[] map) {
		int pre = 0;
		for (int i : map) {
			if (pre > i) {
				return false;
			}
			pre = i;
		}
		return true;
	} check {
		int pre = 0;
		for (int i : map) {
			if (pre > i) {
				return false;
			}
			pre = i;
		}
		return true;
	} int pre = 0; pre 0 for (int i : map) {
			if (pre > i) {
				return false;
			}
			pre = i;
		} int i map {
			if (pre > i) {
				return false;
			}
			pre = i;
		} {
			if (pre > i) {
				return false;
			}
			pre = i;
		} if (pre > i) {
				return false;
			} pre > i pre i {
				return false;
			} return false; false pre = i pre i return true; true int[] map map public class Main {

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

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int N = sc.nextInt();
		
		int[] map = new int[N];
		for (int i = 0; i < N; i++) {
			map[i] = sc.nextInt();
		}
		
		if (check(map)) {
			System.out.println("YES");
			return;
		}
		
		for (int i = 0; i < map.length-1; i++) {
			for (int j = i+1; j < map.length; j++) {
				
				int tmp = map[i];
				map[i] = map[j];
				map[j] = tmp;
				
				if (check(map)) {
					System.out.println("YES");
					return;
				}
				
				map[j] = map[i];
				map[i] = tmp;
				
			}
		}
	
		System.out.println("NO");
	}
	
	static boolean check(int[] map) {
		int pre = 0;
		for (int i : map) {
			if (pre > i) {
				return false;
			}
			pre = i;
		}
		return true;
	}
	
} 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[] map = new int[N];
		for (int i = 0; i < N; i++) {
			map[i] = sc.nextInt();
		}
		
		if (check(map)) {
			System.out.println("YES");
			return;
		}
		
		for (int i = 0; i < map.length-1; i++) {
			for (int j = i+1; j < map.length; j++) {
				
				int tmp = map[i];
				map[i] = map[j];
				map[j] = tmp;
				
				if (check(map)) {
					System.out.println("YES");
					return;
				}
				
				map[j] = map[i];
				map[i] = tmp;
				
			}
		}
	
		System.out.println("NO");
	}
	
	static boolean check(int[] map) {
		int pre = 0;
		for (int i : map) {
			if (pre > i) {
				return false;
			}
			pre = i;
		}
		return true;
	}
	
}

