import java.util.*;

public class Main {
	public static void main(String[] args) {
		Main main = new Main();
		main.run();
	}

	public void run() {
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		int p[] =new int[n];


		int cnt=0;
		for(int i=0; i<n; i++) {
			p[i]=sc.nextInt();
			if(i>0 && p[i-1]>p[i]) {
				cnt++;
			}
		}
		if(cnt==0) {
			System.out.println("YES");
			sc.close();
			return;
		}
		for(int i=0; i<n; i++) {
			for(int j=i+1; j<n; j++) {
				int tmp = p[j];
				p[j] = p[i];
				p[i] = tmp;
				cnt=0;
				for(int k=0; k<n; k++) {
					if(k>0 && p[k-1]>p[k]) {
						cnt++;
					}
				}
				if(cnt==0) {
					System.out.println("YES");
					sc.close();
					return;
				}
				tmp = p[j];
				p[j] = p[i];
				p[i] = tmp;
			}
		}
		System.out.println("NO");
		sc.close();
	}
} import java.util.*; util.* java public class Main {
	public static void main(String[] args) {
		Main main = new Main();
		main.run();
	}

	public void run() {
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		int p[] =new int[n];


		int cnt=0;
		for(int i=0; i<n; i++) {
			p[i]=sc.nextInt();
			if(i>0 && p[i-1]>p[i]) {
				cnt++;
			}
		}
		if(cnt==0) {
			System.out.println("YES");
			sc.close();
			return;
		}
		for(int i=0; i<n; i++) {
			for(int j=i+1; j<n; j++) {
				int tmp = p[j];
				p[j] = p[i];
				p[i] = tmp;
				cnt=0;
				for(int k=0; k<n; k++) {
					if(k>0 && p[k-1]>p[k]) {
						cnt++;
					}
				}
				if(cnt==0) {
					System.out.println("YES");
					sc.close();
					return;
				}
				tmp = p[j];
				p[j] = p[i];
				p[i] = tmp;
			}
		}
		System.out.println("NO");
		sc.close();
	}
} Main public static void main(String[] args) {
		Main main = new Main();
		main.run();
	} main {
		Main main = new Main();
		main.run();
	} Main main = new Main(); main new Main() main.run() main.run main String[] args args public void run() {
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		int p[] =new int[n];


		int cnt=0;
		for(int i=0; i<n; i++) {
			p[i]=sc.nextInt();
			if(i>0 && p[i-1]>p[i]) {
				cnt++;
			}
		}
		if(cnt==0) {
			System.out.println("YES");
			sc.close();
			return;
		}
		for(int i=0; i<n; i++) {
			for(int j=i+1; j<n; j++) {
				int tmp = p[j];
				p[j] = p[i];
				p[i] = tmp;
				cnt=0;
				for(int k=0; k<n; k++) {
					if(k>0 && p[k-1]>p[k]) {
						cnt++;
					}
				}
				if(cnt==0) {
					System.out.println("YES");
					sc.close();
					return;
				}
				tmp = p[j];
				p[j] = p[i];
				p[i] = tmp;
			}
		}
		System.out.println("NO");
		sc.close();
	} run {
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		int p[] =new int[n];


		int cnt=0;
		for(int i=0; i<n; i++) {
			p[i]=sc.nextInt();
			if(i>0 && p[i-1]>p[i]) {
				cnt++;
			}
		}
		if(cnt==0) {
			System.out.println("YES");
			sc.close();
			return;
		}
		for(int i=0; i<n; i++) {
			for(int j=i+1; j<n; j++) {
				int tmp = p[j];
				p[j] = p[i];
				p[i] = tmp;
				cnt=0;
				for(int k=0; k<n; k++) {
					if(k>0 && p[k-1]>p[k]) {
						cnt++;
					}
				}
				if(cnt==0) {
					System.out.println("YES");
					sc.close();
					return;
				}
				tmp = p[j];
				p[j] = p[i];
				p[i] = tmp;
			}
		}
		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 p[] =new int[n]; p new int[n] n int cnt=0; cnt 0 for(int i=0; i<n; i++) {
			p[i]=sc.nextInt();
			if(i>0 && p[i-1]>p[i]) {
				cnt++;
			}
		} int i=0; int i=0; i 0 i<n i n i++ i++ i {
			p[i]=sc.nextInt();
			if(i>0 && p[i-1]>p[i]) {
				cnt++;
			}
		} {
			p[i]=sc.nextInt();
			if(i>0 && p[i-1]>p[i]) {
				cnt++;
			}
		} p[i]=sc.nextInt() p[i] p i sc.nextInt() sc.nextInt sc if(i>0 && p[i-1]>p[i]) {
				cnt++;
			} i>0 && p[i-1]>p[i] i>0 i 0 p[i-1]>p[i] p[i-1] p i-1 i 1 p[i] p i {
				cnt++;
			} cnt++ cnt if(cnt==0) {
			System.out.println("YES");
			sc.close();
			return;
		} cnt==0 cnt 0 {
			System.out.println("YES");
			sc.close();
			return;
		} System.out.println("YES") System.out.println System.out System System.out "YES" sc.close() sc.close sc return; for(int i=0; i<n; i++) {
			for(int j=i+1; j<n; j++) {
				int tmp = p[j];
				p[j] = p[i];
				p[i] = tmp;
				cnt=0;
				for(int k=0; k<n; k++) {
					if(k>0 && p[k-1]>p[k]) {
						cnt++;
					}
				}
				if(cnt==0) {
					System.out.println("YES");
					sc.close();
					return;
				}
				tmp = p[j];
				p[j] = p[i];
				p[i] = 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[j];
				p[j] = p[i];
				p[i] = tmp;
				cnt=0;
				for(int k=0; k<n; k++) {
					if(k>0 && p[k-1]>p[k]) {
						cnt++;
					}
				}
				if(cnt==0) {
					System.out.println("YES");
					sc.close();
					return;
				}
				tmp = p[j];
				p[j] = p[i];
				p[i] = tmp;
			}
		} {
			for(int j=i+1; j<n; j++) {
				int tmp = p[j];
				p[j] = p[i];
				p[i] = tmp;
				cnt=0;
				for(int k=0; k<n; k++) {
					if(k>0 && p[k-1]>p[k]) {
						cnt++;
					}
				}
				if(cnt==0) {
					System.out.println("YES");
					sc.close();
					return;
				}
				tmp = p[j];
				p[j] = p[i];
				p[i] = tmp;
			}
		} for(int j=i+1; j<n; j++) {
				int tmp = p[j];
				p[j] = p[i];
				p[i] = tmp;
				cnt=0;
				for(int k=0; k<n; k++) {
					if(k>0 && p[k-1]>p[k]) {
						cnt++;
					}
				}
				if(cnt==0) {
					System.out.println("YES");
					sc.close();
					return;
				}
				tmp = p[j];
				p[j] = p[i];
				p[i] = tmp;
			} int j=i+1; int j=i+1; j i+1 i 1 j<n j n j++ j++ j {
				int tmp = p[j];
				p[j] = p[i];
				p[i] = tmp;
				cnt=0;
				for(int k=0; k<n; k++) {
					if(k>0 && p[k-1]>p[k]) {
						cnt++;
					}
				}
				if(cnt==0) {
					System.out.println("YES");
					sc.close();
					return;
				}
				tmp = p[j];
				p[j] = p[i];
				p[i] = tmp;
			} {
				int tmp = p[j];
				p[j] = p[i];
				p[i] = tmp;
				cnt=0;
				for(int k=0; k<n; k++) {
					if(k>0 && p[k-1]>p[k]) {
						cnt++;
					}
				}
				if(cnt==0) {
					System.out.println("YES");
					sc.close();
					return;
				}
				tmp = p[j];
				p[j] = p[i];
				p[i] = tmp;
			} int tmp = p[j]; tmp p[j] p j p[j] = p[i] p[j] p j p[i] p i p[i] = tmp p[i] p i tmp cnt=0 cnt 0 for(int k=0; k<n; k++) {
					if(k>0 && p[k-1]>p[k]) {
						cnt++;
					}
				} int k=0; int k=0; k 0 k<n k n k++ k++ k {
					if(k>0 && p[k-1]>p[k]) {
						cnt++;
					}
				} {
					if(k>0 && p[k-1]>p[k]) {
						cnt++;
					}
				} if(k>0 && p[k-1]>p[k]) {
						cnt++;
					} k>0 && p[k-1]>p[k] k>0 k 0 p[k-1]>p[k] p[k-1] p k-1 k 1 p[k] p k {
						cnt++;
					} cnt++ cnt if(cnt==0) {
					System.out.println("YES");
					sc.close();
					return;
				} cnt==0 cnt 0 {
					System.out.println("YES");
					sc.close();
					return;
				} System.out.println("YES") System.out.println System.out System System.out "YES" sc.close() sc.close sc return; tmp = p[j] tmp p[j] p j p[j] = p[i] p[j] p j p[i] p i p[i] = tmp p[i] p i tmp System.out.println("NO") System.out.println System.out System System.out "NO" sc.close() sc.close sc public class Main {
	public static void main(String[] args) {
		Main main = new Main();
		main.run();
	}

	public void run() {
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		int p[] =new int[n];


		int cnt=0;
		for(int i=0; i<n; i++) {
			p[i]=sc.nextInt();
			if(i>0 && p[i-1]>p[i]) {
				cnt++;
			}
		}
		if(cnt==0) {
			System.out.println("YES");
			sc.close();
			return;
		}
		for(int i=0; i<n; i++) {
			for(int j=i+1; j<n; j++) {
				int tmp = p[j];
				p[j] = p[i];
				p[i] = tmp;
				cnt=0;
				for(int k=0; k<n; k++) {
					if(k>0 && p[k-1]>p[k]) {
						cnt++;
					}
				}
				if(cnt==0) {
					System.out.println("YES");
					sc.close();
					return;
				}
				tmp = p[j];
				p[j] = p[i];
				p[i] = tmp;
			}
		}
		System.out.println("NO");
		sc.close();
	}
} public class Main {
	public static void main(String[] args) {
		Main main = new Main();
		main.run();
	}

	public void run() {
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		int p[] =new int[n];


		int cnt=0;
		for(int i=0; i<n; i++) {
			p[i]=sc.nextInt();
			if(i>0 && p[i-1]>p[i]) {
				cnt++;
			}
		}
		if(cnt==0) {
			System.out.println("YES");
			sc.close();
			return;
		}
		for(int i=0; i<n; i++) {
			for(int j=i+1; j<n; j++) {
				int tmp = p[j];
				p[j] = p[i];
				p[i] = tmp;
				cnt=0;
				for(int k=0; k<n; k++) {
					if(k>0 && p[k-1]>p[k]) {
						cnt++;
					}
				}
				if(cnt==0) {
					System.out.println("YES");
					sc.close();
					return;
				}
				tmp = p[j];
				p[j] = p[i];
				p[i] = tmp;
			}
		}
		System.out.println("NO");
		sc.close();
	}
} Main
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Main main = new Main();
		main.run();
	}

	public void run() {
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		int p[] =new int[n];


		int cnt=0;
		for(int i=0; i<n; i++) {
			p[i]=sc.nextInt();
			if(i>0 && p[i-1]>p[i]) {
				cnt++;
			}
		}
		if(cnt==0) {
			System.out.println("YES");
			sc.close();
			return;
		}
		for(int i=0; i<n; i++) {
			for(int j=i+1; j<n; j++) {
				int tmp = p[j];
				p[j] = p[i];
				p[i] = tmp;
				cnt=0;
				for(int k=0; k<n; k++) {
					if(k>0 && p[k-1]>p[k]) {
						cnt++;
					}
				}
				if(cnt==0) {
					System.out.println("YES");
					sc.close();
					return;
				}
				tmp = p[j];
				p[j] = p[i];
				p[i] = tmp;
			}
		}
		System.out.println("NO");
		sc.close();
	}
}
