import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int N = scanner.nextInt();
		int i = 0;
		int j = 0;
		int k = 0;
		int flag = 0;
		
		int baf = 0;
		int[] Li = new int [N];
		int[] Li2 = new int[N];
		for(i=0;i<N;i++) {
			Li[i] = scanner.nextInt();
		}

		
		for(i=0;i<N;i++) {
			for(j=i+1;j<N;j++) {
				System.arraycopy(Li, 0, Li2, 0, N);
				baf = Li2[i];
				Li2[i] = Li2[j];
				Li2[j] = baf;
				flag = 0;
				for(k=0;k<N-1;k++) {
					
					if(Li2[k] > Li2[k+1]) {
						flag  = -1;
						break;
					}
					
				}
				if(flag == 0) {
					flag = 1;
					break;
				}
				
			}
			if(flag == 1) {
				break;
			}
		}
		if(flag != 1) {
			flag = 0;
			for(i=0;i<N-1;i++) {
				
				if(Li[i] > Li[i+1]) {
					flag = -1;
					break;
					
				}
			}
			if (flag != -1) {
				flag = 1;
			}
		}
		if (flag == 1) {
			System.out.print("YES");
		}else {
			System.out.print("NO");
		}
	}
} import java.util.*; util.* java public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int N = scanner.nextInt();
		int i = 0;
		int j = 0;
		int k = 0;
		int flag = 0;
		
		int baf = 0;
		int[] Li = new int [N];
		int[] Li2 = new int[N];
		for(i=0;i<N;i++) {
			Li[i] = scanner.nextInt();
		}

		
		for(i=0;i<N;i++) {
			for(j=i+1;j<N;j++) {
				System.arraycopy(Li, 0, Li2, 0, N);
				baf = Li2[i];
				Li2[i] = Li2[j];
				Li2[j] = baf;
				flag = 0;
				for(k=0;k<N-1;k++) {
					
					if(Li2[k] > Li2[k+1]) {
						flag  = -1;
						break;
					}
					
				}
				if(flag == 0) {
					flag = 1;
					break;
				}
				
			}
			if(flag == 1) {
				break;
			}
		}
		if(flag != 1) {
			flag = 0;
			for(i=0;i<N-1;i++) {
				
				if(Li[i] > Li[i+1]) {
					flag = -1;
					break;
					
				}
			}
			if (flag != -1) {
				flag = 1;
			}
		}
		if (flag == 1) {
			System.out.print("YES");
		}else {
			System.out.print("NO");
		}
	}
} Main public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int N = scanner.nextInt();
		int i = 0;
		int j = 0;
		int k = 0;
		int flag = 0;
		
		int baf = 0;
		int[] Li = new int [N];
		int[] Li2 = new int[N];
		for(i=0;i<N;i++) {
			Li[i] = scanner.nextInt();
		}

		
		for(i=0;i<N;i++) {
			for(j=i+1;j<N;j++) {
				System.arraycopy(Li, 0, Li2, 0, N);
				baf = Li2[i];
				Li2[i] = Li2[j];
				Li2[j] = baf;
				flag = 0;
				for(k=0;k<N-1;k++) {
					
					if(Li2[k] > Li2[k+1]) {
						flag  = -1;
						break;
					}
					
				}
				if(flag == 0) {
					flag = 1;
					break;
				}
				
			}
			if(flag == 1) {
				break;
			}
		}
		if(flag != 1) {
			flag = 0;
			for(i=0;i<N-1;i++) {
				
				if(Li[i] > Li[i+1]) {
					flag = -1;
					break;
					
				}
			}
			if (flag != -1) {
				flag = 1;
			}
		}
		if (flag == 1) {
			System.out.print("YES");
		}else {
			System.out.print("NO");
		}
	} main {
		Scanner scanner = new Scanner(System.in);
		int N = scanner.nextInt();
		int i = 0;
		int j = 0;
		int k = 0;
		int flag = 0;
		
		int baf = 0;
		int[] Li = new int [N];
		int[] Li2 = new int[N];
		for(i=0;i<N;i++) {
			Li[i] = scanner.nextInt();
		}

		
		for(i=0;i<N;i++) {
			for(j=i+1;j<N;j++) {
				System.arraycopy(Li, 0, Li2, 0, N);
				baf = Li2[i];
				Li2[i] = Li2[j];
				Li2[j] = baf;
				flag = 0;
				for(k=0;k<N-1;k++) {
					
					if(Li2[k] > Li2[k+1]) {
						flag  = -1;
						break;
					}
					
				}
				if(flag == 0) {
					flag = 1;
					break;
				}
				
			}
			if(flag == 1) {
				break;
			}
		}
		if(flag != 1) {
			flag = 0;
			for(i=0;i<N-1;i++) {
				
				if(Li[i] > Li[i+1]) {
					flag = -1;
					break;
					
				}
			}
			if (flag != -1) {
				flag = 1;
			}
		}
		if (flag == 1) {
			System.out.print("YES");
		}else {
			System.out.print("NO");
		}
	} Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int N = scanner.nextInt(); N scanner.nextInt() scanner.nextInt scanner int i = 0; i 0 int j = 0; j 0 int k = 0; k 0 int flag = 0; flag 0 int baf = 0; baf 0 int[] Li = new int [N]; Li new int [N] N int[] Li2 = new int[N]; Li2 new int[N] N for(i=0;i<N;i++) {
			Li[i] = scanner.nextInt();
		} i=0; i=0 i 0 i<N i N i++ i++ i {
			Li[i] = scanner.nextInt();
		} {
			Li[i] = scanner.nextInt();
		} Li[i] = scanner.nextInt() Li[i] Li i scanner.nextInt() scanner.nextInt scanner for(i=0;i<N;i++) {
			for(j=i+1;j<N;j++) {
				System.arraycopy(Li, 0, Li2, 0, N);
				baf = Li2[i];
				Li2[i] = Li2[j];
				Li2[j] = baf;
				flag = 0;
				for(k=0;k<N-1;k++) {
					
					if(Li2[k] > Li2[k+1]) {
						flag  = -1;
						break;
					}
					
				}
				if(flag == 0) {
					flag = 1;
					break;
				}
				
			}
			if(flag == 1) {
				break;
			}
		} i=0; i=0 i 0 i<N i N i++ i++ i {
			for(j=i+1;j<N;j++) {
				System.arraycopy(Li, 0, Li2, 0, N);
				baf = Li2[i];
				Li2[i] = Li2[j];
				Li2[j] = baf;
				flag = 0;
				for(k=0;k<N-1;k++) {
					
					if(Li2[k] > Li2[k+1]) {
						flag  = -1;
						break;
					}
					
				}
				if(flag == 0) {
					flag = 1;
					break;
				}
				
			}
			if(flag == 1) {
				break;
			}
		} {
			for(j=i+1;j<N;j++) {
				System.arraycopy(Li, 0, Li2, 0, N);
				baf = Li2[i];
				Li2[i] = Li2[j];
				Li2[j] = baf;
				flag = 0;
				for(k=0;k<N-1;k++) {
					
					if(Li2[k] > Li2[k+1]) {
						flag  = -1;
						break;
					}
					
				}
				if(flag == 0) {
					flag = 1;
					break;
				}
				
			}
			if(flag == 1) {
				break;
			}
		} for(j=i+1;j<N;j++) {
				System.arraycopy(Li, 0, Li2, 0, N);
				baf = Li2[i];
				Li2[i] = Li2[j];
				Li2[j] = baf;
				flag = 0;
				for(k=0;k<N-1;k++) {
					
					if(Li2[k] > Li2[k+1]) {
						flag  = -1;
						break;
					}
					
				}
				if(flag == 0) {
					flag = 1;
					break;
				}
				
			} j=i+1; j=i+1 j i+1 i 1 j<N j N j++ j++ j {
				System.arraycopy(Li, 0, Li2, 0, N);
				baf = Li2[i];
				Li2[i] = Li2[j];
				Li2[j] = baf;
				flag = 0;
				for(k=0;k<N-1;k++) {
					
					if(Li2[k] > Li2[k+1]) {
						flag  = -1;
						break;
					}
					
				}
				if(flag == 0) {
					flag = 1;
					break;
				}
				
			} {
				System.arraycopy(Li, 0, Li2, 0, N);
				baf = Li2[i];
				Li2[i] = Li2[j];
				Li2[j] = baf;
				flag = 0;
				for(k=0;k<N-1;k++) {
					
					if(Li2[k] > Li2[k+1]) {
						flag  = -1;
						break;
					}
					
				}
				if(flag == 0) {
					flag = 1;
					break;
				}
				
			} System.arraycopy(Li, 0, Li2, 0, N) System.arraycopy System Li 0 Li2 0 N baf = Li2[i] baf Li2[i] Li2 i Li2[i] = Li2[j] Li2[i] Li2 i Li2[j] Li2 j Li2[j] = baf Li2[j] Li2 j baf flag = 0 flag 0 for(k=0;k<N-1;k++) {
					
					if(Li2[k] > Li2[k+1]) {
						flag  = -1;
						break;
					}
					
				} k=0; k=0 k 0 k<N-1 k N-1 N 1 k++ k++ k {
					
					if(Li2[k] > Li2[k+1]) {
						flag  = -1;
						break;
					}
					
				} {
					
					if(Li2[k] > Li2[k+1]) {
						flag  = -1;
						break;
					}
					
				} if(Li2[k] > Li2[k+1]) {
						flag  = -1;
						break;
					} Li2[k] > Li2[k+1] Li2[k] Li2 k Li2[k+1] Li2 k+1 k 1 {
						flag  = -1;
						break;
					} flag  = -1 flag -1 1 break; if(flag == 0) {
					flag = 1;
					break;
				} flag == 0 flag 0 {
					flag = 1;
					break;
				} flag = 1 flag 1 break; if(flag == 1) {
				break;
			} flag == 1 flag 1 {
				break;
			} break; if(flag != 1) {
			flag = 0;
			for(i=0;i<N-1;i++) {
				
				if(Li[i] > Li[i+1]) {
					flag = -1;
					break;
					
				}
			}
			if (flag != -1) {
				flag = 1;
			}
		} flag != 1 flag 1 {
			flag = 0;
			for(i=0;i<N-1;i++) {
				
				if(Li[i] > Li[i+1]) {
					flag = -1;
					break;
					
				}
			}
			if (flag != -1) {
				flag = 1;
			}
		} flag = 0 flag 0 for(i=0;i<N-1;i++) {
				
				if(Li[i] > Li[i+1]) {
					flag = -1;
					break;
					
				}
			} i=0; i=0 i 0 i<N-1 i N-1 N 1 i++ i++ i {
				
				if(Li[i] > Li[i+1]) {
					flag = -1;
					break;
					
				}
			} {
				
				if(Li[i] > Li[i+1]) {
					flag = -1;
					break;
					
				}
			} if(Li[i] > Li[i+1]) {
					flag = -1;
					break;
					
				} Li[i] > Li[i+1] Li[i] Li i Li[i+1] Li i+1 i 1 {
					flag = -1;
					break;
					
				} flag = -1 flag -1 1 break; if (flag != -1) {
				flag = 1;
			} flag != -1 flag -1 1 {
				flag = 1;
			} flag = 1 flag 1 if (flag == 1) {
			System.out.print("YES");
		}else {
			System.out.print("NO");
		} flag == 1 flag 1 {
			System.out.print("YES");
		} System.out.print("YES") System.out.print System.out System System.out "YES" {
			System.out.print("NO");
		} System.out.print("NO") System.out.print System.out System System.out "NO" String[] args args public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int N = scanner.nextInt();
		int i = 0;
		int j = 0;
		int k = 0;
		int flag = 0;
		
		int baf = 0;
		int[] Li = new int [N];
		int[] Li2 = new int[N];
		for(i=0;i<N;i++) {
			Li[i] = scanner.nextInt();
		}

		
		for(i=0;i<N;i++) {
			for(j=i+1;j<N;j++) {
				System.arraycopy(Li, 0, Li2, 0, N);
				baf = Li2[i];
				Li2[i] = Li2[j];
				Li2[j] = baf;
				flag = 0;
				for(k=0;k<N-1;k++) {
					
					if(Li2[k] > Li2[k+1]) {
						flag  = -1;
						break;
					}
					
				}
				if(flag == 0) {
					flag = 1;
					break;
				}
				
			}
			if(flag == 1) {
				break;
			}
		}
		if(flag != 1) {
			flag = 0;
			for(i=0;i<N-1;i++) {
				
				if(Li[i] > Li[i+1]) {
					flag = -1;
					break;
					
				}
			}
			if (flag != -1) {
				flag = 1;
			}
		}
		if (flag == 1) {
			System.out.print("YES");
		}else {
			System.out.print("NO");
		}
	}
} public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int N = scanner.nextInt();
		int i = 0;
		int j = 0;
		int k = 0;
		int flag = 0;
		
		int baf = 0;
		int[] Li = new int [N];
		int[] Li2 = new int[N];
		for(i=0;i<N;i++) {
			Li[i] = scanner.nextInt();
		}

		
		for(i=0;i<N;i++) {
			for(j=i+1;j<N;j++) {
				System.arraycopy(Li, 0, Li2, 0, N);
				baf = Li2[i];
				Li2[i] = Li2[j];
				Li2[j] = baf;
				flag = 0;
				for(k=0;k<N-1;k++) {
					
					if(Li2[k] > Li2[k+1]) {
						flag  = -1;
						break;
					}
					
				}
				if(flag == 0) {
					flag = 1;
					break;
				}
				
			}
			if(flag == 1) {
				break;
			}
		}
		if(flag != 1) {
			flag = 0;
			for(i=0;i<N-1;i++) {
				
				if(Li[i] > Li[i+1]) {
					flag = -1;
					break;
					
				}
			}
			if (flag != -1) {
				flag = 1;
			}
		}
		if (flag == 1) {
			System.out.print("YES");
		}else {
			System.out.print("NO");
		}
	}
} Main
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int N = scanner.nextInt();
		int i = 0;
		int j = 0;
		int k = 0;
		int flag = 0;
		
		int baf = 0;
		int[] Li = new int [N];
		int[] Li2 = new int[N];
		for(i=0;i<N;i++) {
			Li[i] = scanner.nextInt();
		}

		
		for(i=0;i<N;i++) {
			for(j=i+1;j<N;j++) {
				System.arraycopy(Li, 0, Li2, 0, N);
				baf = Li2[i];
				Li2[i] = Li2[j];
				Li2[j] = baf;
				flag = 0;
				for(k=0;k<N-1;k++) {
					
					if(Li2[k] > Li2[k+1]) {
						flag  = -1;
						break;
					}
					
				}
				if(flag == 0) {
					flag = 1;
					break;
				}
				
			}
			if(flag == 1) {
				break;
			}
		}
		if(flag != 1) {
			flag = 0;
			for(i=0;i<N-1;i++) {
				
				if(Li[i] > Li[i+1]) {
					flag = -1;
					break;
					
				}
			}
			if (flag != -1) {
				flag = 1;
			}
		}
		if (flag == 1) {
			System.out.print("YES");
		}else {
			System.out.print("NO");
		}
	}
}