import 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];
        int p_copy[] = new int[n];

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

        if (isIncrease(p)) {
            System.out.println("YES");
        } else {
            boolean canSwap = false;
            for (int i = 0; i < n-1; i++) {
                for (int j = 0; j < n; j++) {
                    for (int k = 0; k < n; k++) {
                        p_copy[k] = p[k];
                    }
                    int dummy = p_copy[i];
                    p_copy[i] = p_copy[j];
                    p_copy[j] = dummy;
                    if (isIncrease(p_copy)) {
                        canSwap = true;
                    }
                }
            }
            if (canSwap) {
                System.out.println("YES");
            } else {
                System.out.println("NO");
            }
        }
    }
    
    static boolean isIncrease(int p[]) {
        for (int i = 0; i < p.length - 1; i++) {
            if (p[i] > p[i+1]) {
                return false;
            }
        }
        return true;
    }

} import java.util.*; util.* java public class Main {
	public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        
        int n = sc.nextInt();
        int p[] = new int[n];
        int p_copy[] = new int[n];

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

        if (isIncrease(p)) {
            System.out.println("YES");
        } else {
            boolean canSwap = false;
            for (int i = 0; i < n-1; i++) {
                for (int j = 0; j < n; j++) {
                    for (int k = 0; k < n; k++) {
                        p_copy[k] = p[k];
                    }
                    int dummy = p_copy[i];
                    p_copy[i] = p_copy[j];
                    p_copy[j] = dummy;
                    if (isIncrease(p_copy)) {
                        canSwap = true;
                    }
                }
            }
            if (canSwap) {
                System.out.println("YES");
            } else {
                System.out.println("NO");
            }
        }
    }
    
    static boolean isIncrease(int p[]) {
        for (int i = 0; i < p.length - 1; i++) {
            if (p[i] > p[i+1]) {
                return false;
            }
        }
        return true;
    }

} Main public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        
        int n = sc.nextInt();
        int p[] = new int[n];
        int p_copy[] = new int[n];

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

        if (isIncrease(p)) {
            System.out.println("YES");
        } else {
            boolean canSwap = false;
            for (int i = 0; i < n-1; i++) {
                for (int j = 0; j < n; j++) {
                    for (int k = 0; k < n; k++) {
                        p_copy[k] = p[k];
                    }
                    int dummy = p_copy[i];
                    p_copy[i] = p_copy[j];
                    p_copy[j] = dummy;
                    if (isIncrease(p_copy)) {
                        canSwap = true;
                    }
                }
            }
            if (canSwap) {
                System.out.println("YES");
            } else {
                System.out.println("NO");
            }
        }
    } main {
        Scanner sc = new Scanner(System.in);
        
        int n = sc.nextInt();
        int p[] = new int[n];
        int p_copy[] = new int[n];

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

        if (isIncrease(p)) {
            System.out.println("YES");
        } else {
            boolean canSwap = false;
            for (int i = 0; i < n-1; i++) {
                for (int j = 0; j < n; j++) {
                    for (int k = 0; k < n; k++) {
                        p_copy[k] = p[k];
                    }
                    int dummy = p_copy[i];
                    p_copy[i] = p_copy[j];
                    p_copy[j] = dummy;
                    if (isIncrease(p_copy)) {
                        canSwap = true;
                    }
                }
            }
            if (canSwap) {
                System.out.println("YES");
            } else {
                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 int p_copy[] = new int[n]; p_copy 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 (isIncrease(p)) {
            System.out.println("YES");
        } else {
            boolean canSwap = false;
            for (int i = 0; i < n-1; i++) {
                for (int j = 0; j < n; j++) {
                    for (int k = 0; k < n; k++) {
                        p_copy[k] = p[k];
                    }
                    int dummy = p_copy[i];
                    p_copy[i] = p_copy[j];
                    p_copy[j] = dummy;
                    if (isIncrease(p_copy)) {
                        canSwap = true;
                    }
                }
            }
            if (canSwap) {
                System.out.println("YES");
            } else {
                System.out.println("NO");
            }
        } isIncrease(p) isIncrease p {
            System.out.println("YES");
        } System.out.println("YES") System.out.println System.out System System.out "YES" {
            boolean canSwap = false;
            for (int i = 0; i < n-1; i++) {
                for (int j = 0; j < n; j++) {
                    for (int k = 0; k < n; k++) {
                        p_copy[k] = p[k];
                    }
                    int dummy = p_copy[i];
                    p_copy[i] = p_copy[j];
                    p_copy[j] = dummy;
                    if (isIncrease(p_copy)) {
                        canSwap = true;
                    }
                }
            }
            if (canSwap) {
                System.out.println("YES");
            } else {
                System.out.println("NO");
            }
        } boolean canSwap = false; canSwap false for (int i = 0; i < n-1; i++) {
                for (int j = 0; j < n; j++) {
                    for (int k = 0; k < n; k++) {
                        p_copy[k] = p[k];
                    }
                    int dummy = p_copy[i];
                    p_copy[i] = p_copy[j];
                    p_copy[j] = dummy;
                    if (isIncrease(p_copy)) {
                        canSwap = true;
                    }
                }
            } int i = 0; int i = 0; i 0 i < n-1 i n-1 n 1 i++ i++ i {
                for (int j = 0; j < n; j++) {
                    for (int k = 0; k < n; k++) {
                        p_copy[k] = p[k];
                    }
                    int dummy = p_copy[i];
                    p_copy[i] = p_copy[j];
                    p_copy[j] = dummy;
                    if (isIncrease(p_copy)) {
                        canSwap = true;
                    }
                }
            } {
                for (int j = 0; j < n; j++) {
                    for (int k = 0; k < n; k++) {
                        p_copy[k] = p[k];
                    }
                    int dummy = p_copy[i];
                    p_copy[i] = p_copy[j];
                    p_copy[j] = dummy;
                    if (isIncrease(p_copy)) {
                        canSwap = true;
                    }
                }
            } for (int j = 0; j < n; j++) {
                    for (int k = 0; k < n; k++) {
                        p_copy[k] = p[k];
                    }
                    int dummy = p_copy[i];
                    p_copy[i] = p_copy[j];
                    p_copy[j] = dummy;
                    if (isIncrease(p_copy)) {
                        canSwap = true;
                    }
                } int j = 0; int j = 0; j 0 j < n j n j++ j++ j {
                    for (int k = 0; k < n; k++) {
                        p_copy[k] = p[k];
                    }
                    int dummy = p_copy[i];
                    p_copy[i] = p_copy[j];
                    p_copy[j] = dummy;
                    if (isIncrease(p_copy)) {
                        canSwap = true;
                    }
                } {
                    for (int k = 0; k < n; k++) {
                        p_copy[k] = p[k];
                    }
                    int dummy = p_copy[i];
                    p_copy[i] = p_copy[j];
                    p_copy[j] = dummy;
                    if (isIncrease(p_copy)) {
                        canSwap = true;
                    }
                } for (int k = 0; k < n; k++) {
                        p_copy[k] = p[k];
                    } int k = 0; int k = 0; k 0 k < n k n k++ k++ k {
                        p_copy[k] = p[k];
                    } {
                        p_copy[k] = p[k];
                    } p_copy[k] = p[k] p_copy[k] p_copy k p[k] p k int dummy = p_copy[i]; dummy p_copy[i] p_copy i p_copy[i] = p_copy[j] p_copy[i] p_copy i p_copy[j] p_copy j p_copy[j] = dummy p_copy[j] p_copy j dummy if (isIncrease(p_copy)) {
                        canSwap = true;
                    } isIncrease(p_copy) isIncrease p_copy {
                        canSwap = true;
                    } canSwap = true canSwap true if (canSwap) {
                System.out.println("YES");
            } else {
                System.out.println("NO");
            } canSwap {
                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" String[] args args static boolean isIncrease(int p[]) {
        for (int i = 0; i < p.length - 1; i++) {
            if (p[i] > p[i+1]) {
                return false;
            }
        }
        return true;
    } isIncrease {
        for (int i = 0; i < p.length - 1; i++) {
            if (p[i] > p[i+1]) {
                return false;
            }
        }
        return true;
    } for (int i = 0; i < p.length - 1; i++) {
            if (p[i] > p[i+1]) {
                return false;
            }
        } 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]) {
                return false;
            }
        } {
            if (p[i] > p[i+1]) {
                return false;
            }
        } if (p[i] > p[i+1]) {
                return false;
            } p[i] > p[i+1] p[i] p i p[i+1] p i+1 i 1 {
                return false;
            } return false; false return true; true 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];
        int p_copy[] = new int[n];

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

        if (isIncrease(p)) {
            System.out.println("YES");
        } else {
            boolean canSwap = false;
            for (int i = 0; i < n-1; i++) {
                for (int j = 0; j < n; j++) {
                    for (int k = 0; k < n; k++) {
                        p_copy[k] = p[k];
                    }
                    int dummy = p_copy[i];
                    p_copy[i] = p_copy[j];
                    p_copy[j] = dummy;
                    if (isIncrease(p_copy)) {
                        canSwap = true;
                    }
                }
            }
            if (canSwap) {
                System.out.println("YES");
            } else {
                System.out.println("NO");
            }
        }
    }
    
    static boolean isIncrease(int p[]) {
        for (int i = 0; i < p.length - 1; i++) {
            if (p[i] > p[i+1]) {
                return false;
            }
        }
        return true;
    }

} public class Main {
	public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        
        int n = sc.nextInt();
        int p[] = new int[n];
        int p_copy[] = new int[n];

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

        if (isIncrease(p)) {
            System.out.println("YES");
        } else {
            boolean canSwap = false;
            for (int i = 0; i < n-1; i++) {
                for (int j = 0; j < n; j++) {
                    for (int k = 0; k < n; k++) {
                        p_copy[k] = p[k];
                    }
                    int dummy = p_copy[i];
                    p_copy[i] = p_copy[j];
                    p_copy[j] = dummy;
                    if (isIncrease(p_copy)) {
                        canSwap = true;
                    }
                }
            }
            if (canSwap) {
                System.out.println("YES");
            } else {
                System.out.println("NO");
            }
        }
    }
    
    static boolean isIncrease(int p[]) {
        for (int i = 0; i < p.length - 1; i++) {
            if (p[i] > p[i+1]) {
                return false;
            }
        }
        return true;
    }

} Main
import 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];
        int p_copy[] = new int[n];

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

        if (isIncrease(p)) {
            System.out.println("YES");
        } else {
            boolean canSwap = false;
            for (int i = 0; i < n-1; i++) {
                for (int j = 0; j < n; j++) {
                    for (int k = 0; k < n; k++) {
                        p_copy[k] = p[k];
                    }
                    int dummy = p_copy[i];
                    p_copy[i] = p_copy[j];
                    p_copy[j] = dummy;
                    if (isIncrease(p_copy)) {
                        canSwap = true;
                    }
                }
            }
            if (canSwap) {
                System.out.println("YES");
            } else {
                System.out.println("NO");
            }
        }
    }
    
    static boolean isIncrease(int p[]) {
        for (int i = 0; i < p.length - 1; i++) {
            if (p[i] > p[i+1]) {
                return false;
            }
        }
        return true;
    }

}
