import java.util.Scanner;

public class Main {
 
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] num = new int [N];
		int culc = 0;
		int temp = 0;
		int number = 0;
		boolean ans = true;
		
		for(int i = 0; i < N; i++) {
			num[i] = sc.nextInt();
		}

		for(int i = 0; i < N - 1; i++) {
			if(num[i + 1] < num[i]) {
				if(culc == 0) {
					temp = num[i];
					number = i;
					culc++;
				}else {
					num[number] = num[i + 1];
					num[i + 1] = temp;
				}
			}
		}
		
		for(int i = 0; i < N - 1; i++) {
			if(!(num[i] < num[i + 1])) {
				ans = false;
			}
		}
		
		if(ans) {
			System.out.println("YES");
		}else {
			System.out.println("NO");
		}
		sc.close();
	}
} 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[] num = new int [N];
		int culc = 0;
		int temp = 0;
		int number = 0;
		boolean ans = true;
		
		for(int i = 0; i < N; i++) {
			num[i] = sc.nextInt();
		}

		for(int i = 0; i < N - 1; i++) {
			if(num[i + 1] < num[i]) {
				if(culc == 0) {
					temp = num[i];
					number = i;
					culc++;
				}else {
					num[number] = num[i + 1];
					num[i + 1] = temp;
				}
			}
		}
		
		for(int i = 0; i < N - 1; i++) {
			if(!(num[i] < num[i + 1])) {
				ans = false;
			}
		}
		
		if(ans) {
			System.out.println("YES");
		}else {
			System.out.println("NO");
		}
		sc.close();
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] num = new int [N];
		int culc = 0;
		int temp = 0;
		int number = 0;
		boolean ans = true;
		
		for(int i = 0; i < N; i++) {
			num[i] = sc.nextInt();
		}

		for(int i = 0; i < N - 1; i++) {
			if(num[i + 1] < num[i]) {
				if(culc == 0) {
					temp = num[i];
					number = i;
					culc++;
				}else {
					num[number] = num[i + 1];
					num[i + 1] = temp;
				}
			}
		}
		
		for(int i = 0; i < N - 1; i++) {
			if(!(num[i] < num[i + 1])) {
				ans = false;
			}
		}
		
		if(ans) {
			System.out.println("YES");
		}else {
			System.out.println("NO");
		}
		sc.close();
	} main {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] num = new int [N];
		int culc = 0;
		int temp = 0;
		int number = 0;
		boolean ans = true;
		
		for(int i = 0; i < N; i++) {
			num[i] = sc.nextInt();
		}

		for(int i = 0; i < N - 1; i++) {
			if(num[i + 1] < num[i]) {
				if(culc == 0) {
					temp = num[i];
					number = i;
					culc++;
				}else {
					num[number] = num[i + 1];
					num[i + 1] = temp;
				}
			}
		}
		
		for(int i = 0; i < N - 1; i++) {
			if(!(num[i] < num[i + 1])) {
				ans = false;
			}
		}
		
		if(ans) {
			System.out.println("YES");
		}else {
			System.out.println("NO");
		}
		sc.close();
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int[] num = new int [N]; num new int [N] N int culc = 0; culc 0 int temp = 0; temp 0 int number = 0; number 0 boolean ans = true; ans true for(int i = 0; i < N; i++) {
			num[i] = sc.nextInt();
		} int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
			num[i] = sc.nextInt();
		} {
			num[i] = sc.nextInt();
		} num[i] = sc.nextInt() num[i] num i sc.nextInt() sc.nextInt sc for(int i = 0; i < N - 1; i++) {
			if(num[i + 1] < num[i]) {
				if(culc == 0) {
					temp = num[i];
					number = i;
					culc++;
				}else {
					num[number] = num[i + 1];
					num[i + 1] = temp;
				}
			}
		} int i = 0; int i = 0; i 0 i < N - 1 i N - 1 N 1 i++ i++ i {
			if(num[i + 1] < num[i]) {
				if(culc == 0) {
					temp = num[i];
					number = i;
					culc++;
				}else {
					num[number] = num[i + 1];
					num[i + 1] = temp;
				}
			}
		} {
			if(num[i + 1] < num[i]) {
				if(culc == 0) {
					temp = num[i];
					number = i;
					culc++;
				}else {
					num[number] = num[i + 1];
					num[i + 1] = temp;
				}
			}
		} if(num[i + 1] < num[i]) {
				if(culc == 0) {
					temp = num[i];
					number = i;
					culc++;
				}else {
					num[number] = num[i + 1];
					num[i + 1] = temp;
				}
			} num[i + 1] < num[i] num[i + 1] num i + 1 i 1 num[i] num i {
				if(culc == 0) {
					temp = num[i];
					number = i;
					culc++;
				}else {
					num[number] = num[i + 1];
					num[i + 1] = temp;
				}
			} if(culc == 0) {
					temp = num[i];
					number = i;
					culc++;
				}else {
					num[number] = num[i + 1];
					num[i + 1] = temp;
				} culc == 0 culc 0 {
					temp = num[i];
					number = i;
					culc++;
				} temp = num[i] temp num[i] num i number = i number i culc++ culc {
					num[number] = num[i + 1];
					num[i + 1] = temp;
				} num[number] = num[i + 1] num[number] num number num[i + 1] num i + 1 i 1 num[i + 1] = temp num[i + 1] num i + 1 i 1 temp for(int i = 0; i < N - 1; i++) {
			if(!(num[i] < num[i + 1])) {
				ans = false;
			}
		} int i = 0; int i = 0; i 0 i < N - 1 i N - 1 N 1 i++ i++ i {
			if(!(num[i] < num[i + 1])) {
				ans = false;
			}
		} {
			if(!(num[i] < num[i + 1])) {
				ans = false;
			}
		} if(!(num[i] < num[i + 1])) {
				ans = false;
			} !(num[i] < num[i + 1]) (num[i] < num[i + 1]) num[i] num i num[i + 1] num i + 1 i 1 {
				ans = false;
			} ans = false ans false if(ans) {
			System.out.println("YES");
		}else {
			System.out.println("NO");
		} ans {
			System.out.println("YES");
		} System.out.println("YES") System.out.println System.out System System.out "YES" {
			System.out.println("NO");
		} System.out.println("NO") System.out.println System.out System System.out "NO" sc.close() sc.close sc String[] args args public class Main {
 
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] num = new int [N];
		int culc = 0;
		int temp = 0;
		int number = 0;
		boolean ans = true;
		
		for(int i = 0; i < N; i++) {
			num[i] = sc.nextInt();
		}

		for(int i = 0; i < N - 1; i++) {
			if(num[i + 1] < num[i]) {
				if(culc == 0) {
					temp = num[i];
					number = i;
					culc++;
				}else {
					num[number] = num[i + 1];
					num[i + 1] = temp;
				}
			}
		}
		
		for(int i = 0; i < N - 1; i++) {
			if(!(num[i] < num[i + 1])) {
				ans = false;
			}
		}
		
		if(ans) {
			System.out.println("YES");
		}else {
			System.out.println("NO");
		}
		sc.close();
	}
} public class Main {
 
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] num = new int [N];
		int culc = 0;
		int temp = 0;
		int number = 0;
		boolean ans = true;
		
		for(int i = 0; i < N; i++) {
			num[i] = sc.nextInt();
		}

		for(int i = 0; i < N - 1; i++) {
			if(num[i + 1] < num[i]) {
				if(culc == 0) {
					temp = num[i];
					number = i;
					culc++;
				}else {
					num[number] = num[i + 1];
					num[i + 1] = temp;
				}
			}
		}
		
		for(int i = 0; i < N - 1; i++) {
			if(!(num[i] < num[i + 1])) {
				ans = false;
			}
		}
		
		if(ans) {
			System.out.println("YES");
		}else {
			System.out.println("NO");
		}
		sc.close();
	}
} 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[] num = new int [N];
		int culc = 0;
		int temp = 0;
		int number = 0;
		boolean ans = true;
		
		for(int i = 0; i < N; i++) {
			num[i] = sc.nextInt();
		}

		for(int i = 0; i < N - 1; i++) {
			if(num[i + 1] < num[i]) {
				if(culc == 0) {
					temp = num[i];
					number = i;
					culc++;
				}else {
					num[number] = num[i + 1];
					num[i + 1] = temp;
				}
			}
		}
		
		for(int i = 0; i < N - 1; i++) {
			if(!(num[i] < num[i + 1])) {
				ans = false;
			}
		}
		
		if(ans) {
			System.out.println("YES");
		}else {
			System.out.println("NO");
		}
		sc.close();
	}
}