import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		int p[] = new int[N];

		for (int i=0; i<N; i++){
			p[i] = sc.nextInt();
		}

		if (judge(p)){
			System.out.println("YES");
			return;
		}

		for (int i=0; i<N; i++){
			for (int j=i+1; j<N; j++){
				if (p[i] > p[j]){
					if (judge(swap(i, j, p))){
						System.out.println("YES");
						return;
					}
				}
			}
		}
		System.out.println("NO");
	}

	public static boolean judge(int[] p){
		boolean result = true;
		for (int i=0; i<p.length-1; i++){
			if (p[i] > p[i+1]){
				result = false;
				break;
			}
		}
		return result;
	}

	public static int[] swap(int a, int b, int[]p){
		int result[] = p.clone();
		result[a] = p[b];
		result[b] = p[a];
		return result;
	}

} 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 p[] = new int[N];

		for (int i=0; i<N; i++){
			p[i] = sc.nextInt();
		}

		if (judge(p)){
			System.out.println("YES");
			return;
		}

		for (int i=0; i<N; i++){
			for (int j=i+1; j<N; j++){
				if (p[i] > p[j]){
					if (judge(swap(i, j, p))){
						System.out.println("YES");
						return;
					}
				}
			}
		}
		System.out.println("NO");
	}

	public static boolean judge(int[] p){
		boolean result = true;
		for (int i=0; i<p.length-1; i++){
			if (p[i] > p[i+1]){
				result = false;
				break;
			}
		}
		return result;
	}

	public static int[] swap(int a, int b, int[]p){
		int result[] = p.clone();
		result[a] = p[b];
		result[b] = p[a];
		return result;
	}

} Main public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		int p[] = new int[N];

		for (int i=0; i<N; i++){
			p[i] = sc.nextInt();
		}

		if (judge(p)){
			System.out.println("YES");
			return;
		}

		for (int i=0; i<N; i++){
			for (int j=i+1; j<N; j++){
				if (p[i] > p[j]){
					if (judge(swap(i, j, p))){
						System.out.println("YES");
						return;
					}
				}
			}
		}
		System.out.println("NO");
	} main {

		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		int p[] = new int[N];

		for (int i=0; i<N; i++){
			p[i] = sc.nextInt();
		}

		if (judge(p)){
			System.out.println("YES");
			return;
		}

		for (int i=0; i<N; i++){
			for (int j=i+1; j<N; j++){
				if (p[i] > p[j]){
					if (judge(swap(i, j, p))){
						System.out.println("YES");
						return;
					}
				}
			}
		}
		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 p[] = new int[N]; p new int[N] N for (int i=0; i<N; i++){
			p[i] = sc.nextInt();
		} int i=0; int i=0; i 0 i<N i N i++ i++ i {
			p[i] = sc.nextInt();
		} {
			p[i] = sc.nextInt();
		} p[i] = sc.nextInt() p[i] p i sc.nextInt() sc.nextInt sc if (judge(p)){
			System.out.println("YES");
			return;
		} judge(p) judge p {
			System.out.println("YES");
			return;
		} System.out.println("YES") System.out.println System.out System System.out "YES" return; for (int i=0; i<N; i++){
			for (int j=i+1; j<N; j++){
				if (p[i] > p[j]){
					if (judge(swap(i, j, p))){
						System.out.println("YES");
						return;
					}
				}
			}
		} int i=0; int i=0; i 0 i<N i N i++ i++ i {
			for (int j=i+1; j<N; j++){
				if (p[i] > p[j]){
					if (judge(swap(i, j, p))){
						System.out.println("YES");
						return;
					}
				}
			}
		} {
			for (int j=i+1; j<N; j++){
				if (p[i] > p[j]){
					if (judge(swap(i, j, p))){
						System.out.println("YES");
						return;
					}
				}
			}
		} for (int j=i+1; j<N; j++){
				if (p[i] > p[j]){
					if (judge(swap(i, j, p))){
						System.out.println("YES");
						return;
					}
				}
			} int j=i+1; int j=i+1; j i+1 i 1 j<N j N j++ j++ j {
				if (p[i] > p[j]){
					if (judge(swap(i, j, p))){
						System.out.println("YES");
						return;
					}
				}
			} {
				if (p[i] > p[j]){
					if (judge(swap(i, j, p))){
						System.out.println("YES");
						return;
					}
				}
			} if (p[i] > p[j]){
					if (judge(swap(i, j, p))){
						System.out.println("YES");
						return;
					}
				} p[i] > p[j] p[i] p i p[j] p j {
					if (judge(swap(i, j, p))){
						System.out.println("YES");
						return;
					}
				} if (judge(swap(i, j, p))){
						System.out.println("YES");
						return;
					} judge(swap(i, j, p)) judge swap(i, j, p) swap i j p {
						System.out.println("YES");
						return;
					} System.out.println("YES") System.out.println System.out System System.out "YES" return; System.out.println("NO") System.out.println System.out System System.out "NO" String[] args args public static boolean judge(int[] p){
		boolean result = true;
		for (int i=0; i<p.length-1; i++){
			if (p[i] > p[i+1]){
				result = false;
				break;
			}
		}
		return result;
	} judge {
		boolean result = true;
		for (int i=0; i<p.length-1; i++){
			if (p[i] > p[i+1]){
				result = false;
				break;
			}
		}
		return result;
	} boolean result = true; result true for (int i=0; i<p.length-1; i++){
			if (p[i] > p[i+1]){
				result = false;
				break;
			}
		} int i=0; int i=0; i 0 i<p.length-1 i p.length-1 p.length p p.length 1 i++ i++ i {
			if (p[i] > p[i+1]){
				result = false;
				break;
			}
		} {
			if (p[i] > p[i+1]){
				result = false;
				break;
			}
		} if (p[i] > p[i+1]){
				result = false;
				break;
			} p[i] > p[i+1] p[i] p i p[i+1] p i+1 i 1 {
				result = false;
				break;
			} result = false result false break; return result; result int[] p p public static int[] swap(int a, int b, int[]p){
		int result[] = p.clone();
		result[a] = p[b];
		result[b] = p[a];
		return result;
	} swap {
		int result[] = p.clone();
		result[a] = p[b];
		result[b] = p[a];
		return result;
	} int result[] = p.clone(); result p.clone() p.clone p result[a] = p[b] result[a] result a p[b] p b result[b] = p[a] result[b] result b p[a] p a return result; result int a a int b b int[]p p public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		int p[] = new int[N];

		for (int i=0; i<N; i++){
			p[i] = sc.nextInt();
		}

		if (judge(p)){
			System.out.println("YES");
			return;
		}

		for (int i=0; i<N; i++){
			for (int j=i+1; j<N; j++){
				if (p[i] > p[j]){
					if (judge(swap(i, j, p))){
						System.out.println("YES");
						return;
					}
				}
			}
		}
		System.out.println("NO");
	}

	public static boolean judge(int[] p){
		boolean result = true;
		for (int i=0; i<p.length-1; i++){
			if (p[i] > p[i+1]){
				result = false;
				break;
			}
		}
		return result;
	}

	public static int[] swap(int a, int b, int[]p){
		int result[] = p.clone();
		result[a] = p[b];
		result[b] = p[a];
		return result;
	}

} public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		int p[] = new int[N];

		for (int i=0; i<N; i++){
			p[i] = sc.nextInt();
		}

		if (judge(p)){
			System.out.println("YES");
			return;
		}

		for (int i=0; i<N; i++){
			for (int j=i+1; j<N; j++){
				if (p[i] > p[j]){
					if (judge(swap(i, j, p))){
						System.out.println("YES");
						return;
					}
				}
			}
		}
		System.out.println("NO");
	}

	public static boolean judge(int[] p){
		boolean result = true;
		for (int i=0; i<p.length-1; i++){
			if (p[i] > p[i+1]){
				result = false;
				break;
			}
		}
		return result;
	}

	public static int[] swap(int a, int b, int[]p){
		int result[] = p.clone();
		result[a] = p[b];
		result[b] = p[a];
		return result;
	}

} 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 p[] = new int[N];

		for (int i=0; i<N; i++){
			p[i] = sc.nextInt();
		}

		if (judge(p)){
			System.out.println("YES");
			return;
		}

		for (int i=0; i<N; i++){
			for (int j=i+1; j<N; j++){
				if (p[i] > p[j]){
					if (judge(swap(i, j, p))){
						System.out.println("YES");
						return;
					}
				}
			}
		}
		System.out.println("NO");
	}

	public static boolean judge(int[] p){
		boolean result = true;
		for (int i=0; i<p.length-1; i++){
			if (p[i] > p[i+1]){
				result = false;
				break;
			}
		}
		return result;
	}

	public static int[] swap(int a, int b, int[]p){
		int result[] = p.clone();
		result[a] = p[b];
		result[b] = p[a];
		return result;
	}

}