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[] px = new int[N];
    int count =0, ans =0;
    for (int i =0; i<N; i++) {
      p[i] = sc.nextInt();
    }
    System.arraycopy(p,0,px,0,p.length);
    Arrays.sort(px); //昇順にした配列
    for (int i =0; i<N; i++) {
      for (int j =i; j<N; j++) {
        int tmp =0; tmp = p[i]; p[i] = p[j]; p[j] = tmp;
        for (int l =0; l<N; l++) {
          if(p[l] == px[l]) count++;
        }
        if(count == N) {
          ans++;
        }
        tmp = p[j]; p[j] = p[i]; p[i] = tmp;
        count =0;
      }
    }
    if (ans != 0) {
      System.out.println("YES");
    } else {
      System.out.println("NO");
    }
  }
} 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[] px = new int[N];
    int count =0, ans =0;
    for (int i =0; i<N; i++) {
      p[i] = sc.nextInt();
    }
    System.arraycopy(p,0,px,0,p.length);
    Arrays.sort(px); //昇順にした配列
    for (int i =0; i<N; i++) {
      for (int j =i; j<N; j++) {
        int tmp =0; tmp = p[i]; p[i] = p[j]; p[j] = tmp;
        for (int l =0; l<N; l++) {
          if(p[l] == px[l]) count++;
        }
        if(count == N) {
          ans++;
        }
        tmp = p[j]; p[j] = p[i]; p[i] = tmp;
        count =0;
      }
    }
    if (ans != 0) {
      System.out.println("YES");
    } else {
      System.out.println("NO");
    }
  }
} Main public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int[] p = new int[N];
    int[] px = new int[N];
    int count =0, ans =0;
    for (int i =0; i<N; i++) {
      p[i] = sc.nextInt();
    }
    System.arraycopy(p,0,px,0,p.length);
    Arrays.sort(px); //昇順にした配列
    for (int i =0; i<N; i++) {
      for (int j =i; j<N; j++) {
        int tmp =0; tmp = p[i]; p[i] = p[j]; p[j] = tmp;
        for (int l =0; l<N; l++) {
          if(p[l] == px[l]) count++;
        }
        if(count == N) {
          ans++;
        }
        tmp = p[j]; p[j] = p[i]; p[i] = tmp;
        count =0;
      }
    }
    if (ans != 0) {
      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[] px = new int[N];
    int count =0, ans =0;
    for (int i =0; i<N; i++) {
      p[i] = sc.nextInt();
    }
    System.arraycopy(p,0,px,0,p.length);
    Arrays.sort(px); //昇順にした配列
    for (int i =0; i<N; i++) {
      for (int j =i; j<N; j++) {
        int tmp =0; tmp = p[i]; p[i] = p[j]; p[j] = tmp;
        for (int l =0; l<N; l++) {
          if(p[l] == px[l]) count++;
        }
        if(count == N) {
          ans++;
        }
        tmp = p[j]; p[j] = p[i]; p[i] = tmp;
        count =0;
      }
    }
    if (ans != 0) {
      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[] px = new int[N]; px new int[N] N int count =0 count 0 ans =0; ans 0 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 System.arraycopy(p,0,px,0,p.length) System.arraycopy System p 0 px 0 p.length p p.length Arrays.sort(px) Arrays.sort Arrays px for (int i =0; i<N; i++) {
      for (int j =i; j<N; j++) {
        int tmp =0; tmp = p[i]; p[i] = p[j]; p[j] = tmp;
        for (int l =0; l<N; l++) {
          if(p[l] == px[l]) count++;
        }
        if(count == N) {
          ans++;
        }
        tmp = p[j]; p[j] = p[i]; p[i] = tmp;
        count =0;
      }
    } int i =0; int i =0; i 0 i<N i N i++ i++ i {
      for (int j =i; j<N; j++) {
        int tmp =0; tmp = p[i]; p[i] = p[j]; p[j] = tmp;
        for (int l =0; l<N; l++) {
          if(p[l] == px[l]) count++;
        }
        if(count == N) {
          ans++;
        }
        tmp = p[j]; p[j] = p[i]; p[i] = tmp;
        count =0;
      }
    } {
      for (int j =i; j<N; j++) {
        int tmp =0; tmp = p[i]; p[i] = p[j]; p[j] = tmp;
        for (int l =0; l<N; l++) {
          if(p[l] == px[l]) count++;
        }
        if(count == N) {
          ans++;
        }
        tmp = p[j]; p[j] = p[i]; p[i] = tmp;
        count =0;
      }
    } for (int j =i; j<N; j++) {
        int tmp =0; tmp = p[i]; p[i] = p[j]; p[j] = tmp;
        for (int l =0; l<N; l++) {
          if(p[l] == px[l]) count++;
        }
        if(count == N) {
          ans++;
        }
        tmp = p[j]; p[j] = p[i]; p[i] = tmp;
        count =0;
      } int j =i; int j =i; j i j<N j N j++ j++ j {
        int tmp =0; tmp = p[i]; p[i] = p[j]; p[j] = tmp;
        for (int l =0; l<N; l++) {
          if(p[l] == px[l]) count++;
        }
        if(count == N) {
          ans++;
        }
        tmp = p[j]; p[j] = p[i]; p[i] = tmp;
        count =0;
      } {
        int tmp =0; tmp = p[i]; p[i] = p[j]; p[j] = tmp;
        for (int l =0; l<N; l++) {
          if(p[l] == px[l]) count++;
        }
        if(count == N) {
          ans++;
        }
        tmp = p[j]; p[j] = p[i]; p[i] = tmp;
        count =0;
      } int tmp =0; tmp 0 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 for (int l =0; l<N; l++) {
          if(p[l] == px[l]) count++;
        } int l =0; int l =0; l 0 l<N l N l++ l++ l {
          if(p[l] == px[l]) count++;
        } {
          if(p[l] == px[l]) count++;
        } if(p[l] == px[l]) count++; p[l] == px[l] p[l] p l px[l] px l count++ count if(count == N) {
          ans++;
        } count == N count N {
          ans++;
        } ans++ ans 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 count =0 count 0 if (ans != 0) {
      System.out.println("YES");
    } else {
      System.out.println("NO");
    } ans != 0 ans 0 {
      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 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[] px = new int[N];
    int count =0, ans =0;
    for (int i =0; i<N; i++) {
      p[i] = sc.nextInt();
    }
    System.arraycopy(p,0,px,0,p.length);
    Arrays.sort(px); //昇順にした配列
    for (int i =0; i<N; i++) {
      for (int j =i; j<N; j++) {
        int tmp =0; tmp = p[i]; p[i] = p[j]; p[j] = tmp;
        for (int l =0; l<N; l++) {
          if(p[l] == px[l]) count++;
        }
        if(count == N) {
          ans++;
        }
        tmp = p[j]; p[j] = p[i]; p[i] = tmp;
        count =0;
      }
    }
    if (ans != 0) {
      System.out.println("YES");
    } else {
      System.out.println("NO");
    }
  }
} 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[] px = new int[N];
    int count =0, ans =0;
    for (int i =0; i<N; i++) {
      p[i] = sc.nextInt();
    }
    System.arraycopy(p,0,px,0,p.length);
    Arrays.sort(px); //昇順にした配列
    for (int i =0; i<N; i++) {
      for (int j =i; j<N; j++) {
        int tmp =0; tmp = p[i]; p[i] = p[j]; p[j] = tmp;
        for (int l =0; l<N; l++) {
          if(p[l] == px[l]) count++;
        }
        if(count == N) {
          ans++;
        }
        tmp = p[j]; p[j] = p[i]; p[i] = tmp;
        count =0;
      }
    }
    if (ans != 0) {
      System.out.println("YES");
    } else {
      System.out.println("NO");
    }
  }
} 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[] px = new int[N];
    int count =0, ans =0;
    for (int i =0; i<N; i++) {
      p[i] = sc.nextInt();
    }
    System.arraycopy(p,0,px,0,p.length);
    Arrays.sort(px); //昇順にした配列
    for (int i =0; i<N; i++) {
      for (int j =i; j<N; j++) {
        int tmp =0; tmp = p[i]; p[i] = p[j]; p[j] = tmp;
        for (int l =0; l<N; l++) {
          if(p[l] == px[l]) count++;
        }
        if(count == N) {
          ans++;
        }
        tmp = p[j]; p[j] = p[i]; p[i] = tmp;
        count =0;
      }
    }
    if (ans != 0) {
      System.out.println("YES");
    } else {
      System.out.println("NO");
    }
  }
}