import java.util.*;
public class Main {
static int A= 0;


	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		A=sc.nextInt();
		int T= 52;
		int S=0;
		int count=0;
		int B =0;
		int C= 0;
		int data []=new int[A];
		
		for(int i=0;i<A;i++) {
		data[i] =sc.nextInt();	
		C = data[i];
		if(B > C) {
			
			if(T==52) {
				
				T=i-1;
				
			}else {
				
				S=i;
				
			}

			count++;
			if(count>2) break;
		}
		B= data[i];
		
		}
		if(count>2) {
			System.out.println("NO");
		}else {
		   if(T!=52 && S!=0) {
			int temp=data[T];
			data[T]=data[S];
			data[S]=temp;
		   }
			for(int i=0;i<A;i++) {
				if(i==A-1) {
					System.out.println("YES");

				}else if( data[i]>data[i+1]) {
					System.out.println("NO");
					break;
				}
		}
		
		

	}
}
} import java.util.*; util.* java public class Main {
static int A= 0;


	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		A=sc.nextInt();
		int T= 52;
		int S=0;
		int count=0;
		int B =0;
		int C= 0;
		int data []=new int[A];
		
		for(int i=0;i<A;i++) {
		data[i] =sc.nextInt();	
		C = data[i];
		if(B > C) {
			
			if(T==52) {
				
				T=i-1;
				
			}else {
				
				S=i;
				
			}

			count++;
			if(count>2) break;
		}
		B= data[i];
		
		}
		if(count>2) {
			System.out.println("NO");
		}else {
		   if(T!=52 && S!=0) {
			int temp=data[T];
			data[T]=data[S];
			data[S]=temp;
		   }
			for(int i=0;i<A;i++) {
				if(i==A-1) {
					System.out.println("YES");

				}else if( data[i]>data[i+1]) {
					System.out.println("NO");
					break;
				}
		}
		
		

	}
}
} Main static int A= 0; A 0 public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		A=sc.nextInt();
		int T= 52;
		int S=0;
		int count=0;
		int B =0;
		int C= 0;
		int data []=new int[A];
		
		for(int i=0;i<A;i++) {
		data[i] =sc.nextInt();	
		C = data[i];
		if(B > C) {
			
			if(T==52) {
				
				T=i-1;
				
			}else {
				
				S=i;
				
			}

			count++;
			if(count>2) break;
		}
		B= data[i];
		
		}
		if(count>2) {
			System.out.println("NO");
		}else {
		   if(T!=52 && S!=0) {
			int temp=data[T];
			data[T]=data[S];
			data[S]=temp;
		   }
			for(int i=0;i<A;i++) {
				if(i==A-1) {
					System.out.println("YES");

				}else if( data[i]>data[i+1]) {
					System.out.println("NO");
					break;
				}
		}
		
		

	}
} main {
		Scanner sc = new Scanner(System.in);
		A=sc.nextInt();
		int T= 52;
		int S=0;
		int count=0;
		int B =0;
		int C= 0;
		int data []=new int[A];
		
		for(int i=0;i<A;i++) {
		data[i] =sc.nextInt();	
		C = data[i];
		if(B > C) {
			
			if(T==52) {
				
				T=i-1;
				
			}else {
				
				S=i;
				
			}

			count++;
			if(count>2) break;
		}
		B= data[i];
		
		}
		if(count>2) {
			System.out.println("NO");
		}else {
		   if(T!=52 && S!=0) {
			int temp=data[T];
			data[T]=data[S];
			data[S]=temp;
		   }
			for(int i=0;i<A;i++) {
				if(i==A-1) {
					System.out.println("YES");

				}else if( data[i]>data[i+1]) {
					System.out.println("NO");
					break;
				}
		}
		
		

	}
} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) A=sc.nextInt() A sc.nextInt() sc.nextInt sc int T= 52; T 52 int S=0; S 0 int count=0; count 0 int B =0; B 0 int C= 0; C 0 int data []=new int[A]; data new int[A] A for(int i=0;i<A;i++) {
		data[i] =sc.nextInt();	
		C = data[i];
		if(B > C) {
			
			if(T==52) {
				
				T=i-1;
				
			}else {
				
				S=i;
				
			}

			count++;
			if(count>2) break;
		}
		B= data[i];
		
		} int i=0; int i=0; i 0 i<A i A i++ i++ i {
		data[i] =sc.nextInt();	
		C = data[i];
		if(B > C) {
			
			if(T==52) {
				
				T=i-1;
				
			}else {
				
				S=i;
				
			}

			count++;
			if(count>2) break;
		}
		B= data[i];
		
		} {
		data[i] =sc.nextInt();	
		C = data[i];
		if(B > C) {
			
			if(T==52) {
				
				T=i-1;
				
			}else {
				
				S=i;
				
			}

			count++;
			if(count>2) break;
		}
		B= data[i];
		
		} data[i] =sc.nextInt() data[i] data i sc.nextInt() sc.nextInt sc C = data[i] C data[i] data i if(B > C) {
			
			if(T==52) {
				
				T=i-1;
				
			}else {
				
				S=i;
				
			}

			count++;
			if(count>2) break;
		} B > C B C {
			
			if(T==52) {
				
				T=i-1;
				
			}else {
				
				S=i;
				
			}

			count++;
			if(count>2) break;
		} if(T==52) {
				
				T=i-1;
				
			}else {
				
				S=i;
				
			} T==52 T 52 {
				
				T=i-1;
				
			} T=i-1 T i-1 i 1 {
				
				S=i;
				
			} S=i S i count++ count if(count>2) break; count>2 count 2 break; B= data[i] B data[i] data i if(count>2) {
			System.out.println("NO");
		}else {
		   if(T!=52 && S!=0) {
			int temp=data[T];
			data[T]=data[S];
			data[S]=temp;
		   }
			for(int i=0;i<A;i++) {
				if(i==A-1) {
					System.out.println("YES");

				}else if( data[i]>data[i+1]) {
					System.out.println("NO");
					break;
				}
		}
		
		

	} count>2 count 2 {
			System.out.println("NO");
		} System.out.println("NO") System.out.println System.out System System.out "NO" {
		   if(T!=52 && S!=0) {
			int temp=data[T];
			data[T]=data[S];
			data[S]=temp;
		   }
			for(int i=0;i<A;i++) {
				if(i==A-1) {
					System.out.println("YES");

				}else if( data[i]>data[i+1]) {
					System.out.println("NO");
					break;
				}
		}
		
		

	} if(T!=52 && S!=0) {
			int temp=data[T];
			data[T]=data[S];
			data[S]=temp;
		   } T!=52 && S!=0 T!=52 T 52 S!=0 S 0 {
			int temp=data[T];
			data[T]=data[S];
			data[S]=temp;
		   } int temp=data[T]; temp data[T] data T data[T]=data[S] data[T] data T data[S] data S data[S]=temp data[S] data S temp for(int i=0;i<A;i++) {
				if(i==A-1) {
					System.out.println("YES");

				}else if( data[i]>data[i+1]) {
					System.out.println("NO");
					break;
				}
		} int i=0; int i=0; i 0 i<A i A i++ i++ i {
				if(i==A-1) {
					System.out.println("YES");

				}else if( data[i]>data[i+1]) {
					System.out.println("NO");
					break;
				}
		} {
				if(i==A-1) {
					System.out.println("YES");

				}else if( data[i]>data[i+1]) {
					System.out.println("NO");
					break;
				}
		} if(i==A-1) {
					System.out.println("YES");

				}else if( data[i]>data[i+1]) {
					System.out.println("NO");
					break;
				} i==A-1 i A-1 A 1 {
					System.out.println("YES");

				} System.out.println("YES") System.out.println System.out System System.out "YES" if( data[i]>data[i+1]) {
					System.out.println("NO");
					break;
				} data[i]>data[i+1] data[i] data i data[i+1] data i+1 i 1 {
					System.out.println("NO");
					break;
				} System.out.println("NO") System.out.println System.out System System.out "NO" break; String args[] args public class Main {
static int A= 0;


	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		A=sc.nextInt();
		int T= 52;
		int S=0;
		int count=0;
		int B =0;
		int C= 0;
		int data []=new int[A];
		
		for(int i=0;i<A;i++) {
		data[i] =sc.nextInt();	
		C = data[i];
		if(B > C) {
			
			if(T==52) {
				
				T=i-1;
				
			}else {
				
				S=i;
				
			}

			count++;
			if(count>2) break;
		}
		B= data[i];
		
		}
		if(count>2) {
			System.out.println("NO");
		}else {
		   if(T!=52 && S!=0) {
			int temp=data[T];
			data[T]=data[S];
			data[S]=temp;
		   }
			for(int i=0;i<A;i++) {
				if(i==A-1) {
					System.out.println("YES");

				}else if( data[i]>data[i+1]) {
					System.out.println("NO");
					break;
				}
		}
		
		

	}
}
} public class Main {
static int A= 0;


	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		A=sc.nextInt();
		int T= 52;
		int S=0;
		int count=0;
		int B =0;
		int C= 0;
		int data []=new int[A];
		
		for(int i=0;i<A;i++) {
		data[i] =sc.nextInt();	
		C = data[i];
		if(B > C) {
			
			if(T==52) {
				
				T=i-1;
				
			}else {
				
				S=i;
				
			}

			count++;
			if(count>2) break;
		}
		B= data[i];
		
		}
		if(count>2) {
			System.out.println("NO");
		}else {
		   if(T!=52 && S!=0) {
			int temp=data[T];
			data[T]=data[S];
			data[S]=temp;
		   }
			for(int i=0;i<A;i++) {
				if(i==A-1) {
					System.out.println("YES");

				}else if( data[i]>data[i+1]) {
					System.out.println("NO");
					break;
				}
		}
		
		

	}
}
} Main
import java.util.*;
public class Main {
static int A= 0;


	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		A=sc.nextInt();
		int T= 52;
		int S=0;
		int count=0;
		int B =0;
		int C= 0;
		int data []=new int[A];
		
		for(int i=0;i<A;i++) {
		data[i] =sc.nextInt();	
		C = data[i];
		if(B > C) {
			
			if(T==52) {
				
				T=i-1;
				
			}else {
				
				S=i;
				
			}

			count++;
			if(count>2) break;
		}
		B= data[i];
		
		}
		if(count>2) {
			System.out.println("NO");
		}else {
		   if(T!=52 && S!=0) {
			int temp=data[T];
			data[T]=data[S];
			data[S]=temp;
		   }
			for(int i=0;i<A;i++) {
				if(i==A-1) {
					System.out.println("YES");

				}else if( data[i]>data[i+1]) {
					System.out.println("NO");
					break;
				}
		}
		
		

	}
}
}
