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 (isAsc(p)) {
            System.out.println("YES");
            return;
        }

        for (int i=0;i<N-1;i++) {
            for (int j = i + 1; j < N; j++) {
                int tmp = p[i];
                p[i] = p[j];
                p[j] = tmp;
                if (isAsc(p)) {
                    System.out.println("YES");
                    return;
                }
                p[j] = p[i];
                p[i] = tmp;
            }
        }
        System.out.println("NO");
    }

    public static boolean isAsc(int a[]) {
        for (int i =0;i<a.length-1;i++) {
            if (a[i] > a[i+1]) return false;
        }
        return true;
    }
} 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 (isAsc(p)) {
            System.out.println("YES");
            return;
        }

        for (int i=0;i<N-1;i++) {
            for (int j = i + 1; j < N; j++) {
                int tmp = p[i];
                p[i] = p[j];
                p[j] = tmp;
                if (isAsc(p)) {
                    System.out.println("YES");
                    return;
                }
                p[j] = p[i];
                p[i] = tmp;
            }
        }
        System.out.println("NO");
    }

    public static boolean isAsc(int a[]) {
        for (int i =0;i<a.length-1;i++) {
            if (a[i] > a[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];

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

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

        for (int i=0;i<N-1;i++) {
            for (int j = i + 1; j < N; j++) {
                int tmp = p[i];
                p[i] = p[j];
                p[j] = tmp;
                if (isAsc(p)) {
                    System.out.println("YES");
                    return;
                }
                p[j] = p[i];
                p[i] = tmp;
            }
        }
        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 (isAsc(p)) {
            System.out.println("YES");
            return;
        }

        for (int i=0;i<N-1;i++) {
            for (int j = i + 1; j < N; j++) {
                int tmp = p[i];
                p[i] = p[j];
                p[j] = tmp;
                if (isAsc(p)) {
                    System.out.println("YES");
                    return;
                }
                p[j] = p[i];
                p[i] = tmp;
            }
        }
        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 (isAsc(p)) {
            System.out.println("YES");
            return;
        } isAsc(p) isAsc 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-1;i++) {
            for (int j = i + 1; j < N; j++) {
                int tmp = p[i];
                p[i] = p[j];
                p[j] = tmp;
                if (isAsc(p)) {
                    System.out.println("YES");
                    return;
                }
                p[j] = p[i];
                p[i] = tmp;
            }
        } int i=0; int i=0; i 0 i<N-1 i N-1 N 1 i++ i++ i {
            for (int j = i + 1; j < N; j++) {
                int tmp = p[i];
                p[i] = p[j];
                p[j] = tmp;
                if (isAsc(p)) {
                    System.out.println("YES");
                    return;
                }
                p[j] = p[i];
                p[i] = tmp;
            }
        } {
            for (int j = i + 1; j < N; j++) {
                int tmp = p[i];
                p[i] = p[j];
                p[j] = tmp;
                if (isAsc(p)) {
                    System.out.println("YES");
                    return;
                }
                p[j] = p[i];
                p[i] = tmp;
            }
        } for (int j = i + 1; j < N; j++) {
                int tmp = p[i];
                p[i] = p[j];
                p[j] = tmp;
                if (isAsc(p)) {
                    System.out.println("YES");
                    return;
                }
                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[i];
                p[i] = p[j];
                p[j] = tmp;
                if (isAsc(p)) {
                    System.out.println("YES");
                    return;
                }
                p[j] = p[i];
                p[i] = tmp;
            } {
                int tmp = p[i];
                p[i] = p[j];
                p[j] = tmp;
                if (isAsc(p)) {
                    System.out.println("YES");
                    return;
                }
                p[j] = p[i];
                p[i] = tmp;
            } int tmp = p[i]; tmp p[i] p i p[i] = p[j] p[i] p i p[j] p j p[j] = tmp p[j] p j tmp if (isAsc(p)) {
                    System.out.println("YES");
                    return;
                } isAsc(p) isAsc p {
                    System.out.println("YES");
                    return;
                } System.out.println("YES") System.out.println System.out System System.out "YES" return; 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" String[] args args public static boolean isAsc(int a[]) {
        for (int i =0;i<a.length-1;i++) {
            if (a[i] > a[i+1]) return false;
        }
        return true;
    } isAsc {
        for (int i =0;i<a.length-1;i++) {
            if (a[i] > a[i+1]) return false;
        }
        return true;
    } for (int i =0;i<a.length-1;i++) {
            if (a[i] > a[i+1]) return false;
        } int i =0; int i =0; i 0 i<a.length-1 i a.length-1 a.length a a.length 1 i++ i++ i {
            if (a[i] > a[i+1]) return false;
        } {
            if (a[i] > a[i+1]) return false;
        } if (a[i] > a[i+1]) return false; a[i] > a[i+1] a[i] a i a[i+1] a i+1 i 1 return false; false return true; true int a[] a 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 (isAsc(p)) {
            System.out.println("YES");
            return;
        }

        for (int i=0;i<N-1;i++) {
            for (int j = i + 1; j < N; j++) {
                int tmp = p[i];
                p[i] = p[j];
                p[j] = tmp;
                if (isAsc(p)) {
                    System.out.println("YES");
                    return;
                }
                p[j] = p[i];
                p[i] = tmp;
            }
        }
        System.out.println("NO");
    }

    public static boolean isAsc(int a[]) {
        for (int i =0;i<a.length-1;i++) {
            if (a[i] > a[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];

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

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

        for (int i=0;i<N-1;i++) {
            for (int j = i + 1; j < N; j++) {
                int tmp = p[i];
                p[i] = p[j];
                p[j] = tmp;
                if (isAsc(p)) {
                    System.out.println("YES");
                    return;
                }
                p[j] = p[i];
                p[i] = tmp;
            }
        }
        System.out.println("NO");
    }

    public static boolean isAsc(int a[]) {
        for (int i =0;i<a.length-1;i++) {
            if (a[i] > a[i+1]) return false;
        }
        return true;
    }
} 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 (isAsc(p)) {
            System.out.println("YES");
            return;
        }

        for (int i=0;i<N-1;i++) {
            for (int j = i + 1; j < N; j++) {
                int tmp = p[i];
                p[i] = p[j];
                p[j] = tmp;
                if (isAsc(p)) {
                    System.out.println("YES");
                    return;
                }
                p[j] = p[i];
                p[i] = tmp;
            }
        }
        System.out.println("NO");
    }

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