import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
       
    int n = scan.nextInt();
    int[] p = new int[n];
    
    for (int i = 0; i < n; i++) {
      p[i] = scan.nextInt();
    }
    
    for (int k = 0; k < n - 1; k++) {
    	if (p[k] > p[k+1]) {
    		break;
    	} else if (k == (n - 2)) {
    		System.out.print("YES");
    		return;
    	}
    }
    
    int[] q = new int[n];
    
    for (int i = 0; i < n - 1; i++) {    
      for (int j = i + 1; j < n; j++) {
    	for (int k = 0; k < n; k++) {
			 q[k] = p[k];
		}
		q[i] = p[j];
		q[j] = p[i];
		
		for (int k = 0; k < n - 1; k++) {
			if (q[k] > q[k+1]) {
				break;
			} else if (k == (n - 2)) {
				System.out.print("YES");
				return;
			}
		}
      }
    }
    
    System.out.print("NO");
    return;
  }
} import java.util.Scanner; Scanner java.util public class Main {

  public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
       
    int n = scan.nextInt();
    int[] p = new int[n];
    
    for (int i = 0; i < n; i++) {
      p[i] = scan.nextInt();
    }
    
    for (int k = 0; k < n - 1; k++) {
    	if (p[k] > p[k+1]) {
    		break;
    	} else if (k == (n - 2)) {
    		System.out.print("YES");
    		return;
    	}
    }
    
    int[] q = new int[n];
    
    for (int i = 0; i < n - 1; i++) {    
      for (int j = i + 1; j < n; j++) {
    	for (int k = 0; k < n; k++) {
			 q[k] = p[k];
		}
		q[i] = p[j];
		q[j] = p[i];
		
		for (int k = 0; k < n - 1; k++) {
			if (q[k] > q[k+1]) {
				break;
			} else if (k == (n - 2)) {
				System.out.print("YES");
				return;
			}
		}
      }
    }
    
    System.out.print("NO");
    return;
  }
} Main public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
       
    int n = scan.nextInt();
    int[] p = new int[n];
    
    for (int i = 0; i < n; i++) {
      p[i] = scan.nextInt();
    }
    
    for (int k = 0; k < n - 1; k++) {
    	if (p[k] > p[k+1]) {
    		break;
    	} else if (k == (n - 2)) {
    		System.out.print("YES");
    		return;
    	}
    }
    
    int[] q = new int[n];
    
    for (int i = 0; i < n - 1; i++) {    
      for (int j = i + 1; j < n; j++) {
    	for (int k = 0; k < n; k++) {
			 q[k] = p[k];
		}
		q[i] = p[j];
		q[j] = p[i];
		
		for (int k = 0; k < n - 1; k++) {
			if (q[k] > q[k+1]) {
				break;
			} else if (k == (n - 2)) {
				System.out.print("YES");
				return;
			}
		}
      }
    }
    
    System.out.print("NO");
    return;
  } main {
    Scanner scan = new Scanner(System.in);
       
    int n = scan.nextInt();
    int[] p = new int[n];
    
    for (int i = 0; i < n; i++) {
      p[i] = scan.nextInt();
    }
    
    for (int k = 0; k < n - 1; k++) {
    	if (p[k] > p[k+1]) {
    		break;
    	} else if (k == (n - 2)) {
    		System.out.print("YES");
    		return;
    	}
    }
    
    int[] q = new int[n];
    
    for (int i = 0; i < n - 1; i++) {    
      for (int j = i + 1; j < n; j++) {
    	for (int k = 0; k < n; k++) {
			 q[k] = p[k];
		}
		q[i] = p[j];
		q[j] = p[i];
		
		for (int k = 0; k < n - 1; k++) {
			if (q[k] > q[k+1]) {
				break;
			} else if (k == (n - 2)) {
				System.out.print("YES");
				return;
			}
		}
      }
    }
    
    System.out.print("NO");
    return;
  } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int n = scan.nextInt(); n scan.nextInt() scan.nextInt scan int[] p = new int[n]; p new int[n] n for (int i = 0; i < n; i++) {
      p[i] = scan.nextInt();
    } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
      p[i] = scan.nextInt();
    } {
      p[i] = scan.nextInt();
    } p[i] = scan.nextInt() p[i] p i scan.nextInt() scan.nextInt scan for (int k = 0; k < n - 1; k++) {
    	if (p[k] > p[k+1]) {
    		break;
    	} else if (k == (n - 2)) {
    		System.out.print("YES");
    		return;
    	}
    } int k = 0; int k = 0; k 0 k < n - 1 k n - 1 n 1 k++ k++ k {
    	if (p[k] > p[k+1]) {
    		break;
    	} else if (k == (n - 2)) {
    		System.out.print("YES");
    		return;
    	}
    } {
    	if (p[k] > p[k+1]) {
    		break;
    	} else if (k == (n - 2)) {
    		System.out.print("YES");
    		return;
    	}
    } if (p[k] > p[k+1]) {
    		break;
    	} else if (k == (n - 2)) {
    		System.out.print("YES");
    		return;
    	} p[k] > p[k+1] p[k] p k p[k+1] p k+1 k 1 {
    		break;
    	} break; if (k == (n - 2)) {
    		System.out.print("YES");
    		return;
    	} k == (n - 2) k (n - 2) n 2 {
    		System.out.print("YES");
    		return;
    	} System.out.print("YES") System.out.print System.out System System.out "YES" return; int[] q = new int[n]; q new int[n] n for (int i = 0; i < n - 1; i++) {    
      for (int j = i + 1; j < n; j++) {
    	for (int k = 0; k < n; k++) {
			 q[k] = p[k];
		}
		q[i] = p[j];
		q[j] = p[i];
		
		for (int k = 0; k < n - 1; k++) {
			if (q[k] > q[k+1]) {
				break;
			} else if (k == (n - 2)) {
				System.out.print("YES");
				return;
			}
		}
      }
    } 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++) {
    	for (int k = 0; k < n; k++) {
			 q[k] = p[k];
		}
		q[i] = p[j];
		q[j] = p[i];
		
		for (int k = 0; k < n - 1; k++) {
			if (q[k] > q[k+1]) {
				break;
			} else if (k == (n - 2)) {
				System.out.print("YES");
				return;
			}
		}
      }
    } {    
      for (int j = i + 1; j < n; j++) {
    	for (int k = 0; k < n; k++) {
			 q[k] = p[k];
		}
		q[i] = p[j];
		q[j] = p[i];
		
		for (int k = 0; k < n - 1; k++) {
			if (q[k] > q[k+1]) {
				break;
			} else if (k == (n - 2)) {
				System.out.print("YES");
				return;
			}
		}
      }
    } for (int j = i + 1; j < n; j++) {
    	for (int k = 0; k < n; k++) {
			 q[k] = p[k];
		}
		q[i] = p[j];
		q[j] = p[i];
		
		for (int k = 0; k < n - 1; k++) {
			if (q[k] > q[k+1]) {
				break;
			} else if (k == (n - 2)) {
				System.out.print("YES");
				return;
			}
		}
      } int j = i + 1; int j = i + 1; j i + 1 i 1 j < n j n j++ j++ j {
    	for (int k = 0; k < n; k++) {
			 q[k] = p[k];
		}
		q[i] = p[j];
		q[j] = p[i];
		
		for (int k = 0; k < n - 1; k++) {
			if (q[k] > q[k+1]) {
				break;
			} else if (k == (n - 2)) {
				System.out.print("YES");
				return;
			}
		}
      } {
    	for (int k = 0; k < n; k++) {
			 q[k] = p[k];
		}
		q[i] = p[j];
		q[j] = p[i];
		
		for (int k = 0; k < n - 1; k++) {
			if (q[k] > q[k+1]) {
				break;
			} else if (k == (n - 2)) {
				System.out.print("YES");
				return;
			}
		}
      } for (int k = 0; k < n; k++) {
			 q[k] = p[k];
		} int k = 0; int k = 0; k 0 k < n k n k++ k++ k {
			 q[k] = p[k];
		} {
			 q[k] = p[k];
		} q[k] = p[k] q[k] q k p[k] p k q[i] = p[j] q[i] q i p[j] p j q[j] = p[i] q[j] q j p[i] p i for (int k = 0; k < n - 1; k++) {
			if (q[k] > q[k+1]) {
				break;
			} else if (k == (n - 2)) {
				System.out.print("YES");
				return;
			}
		} int k = 0; int k = 0; k 0 k < n - 1 k n - 1 n 1 k++ k++ k {
			if (q[k] > q[k+1]) {
				break;
			} else if (k == (n - 2)) {
				System.out.print("YES");
				return;
			}
		} {
			if (q[k] > q[k+1]) {
				break;
			} else if (k == (n - 2)) {
				System.out.print("YES");
				return;
			}
		} if (q[k] > q[k+1]) {
				break;
			} else if (k == (n - 2)) {
				System.out.print("YES");
				return;
			} q[k] > q[k+1] q[k] q k q[k+1] q k+1 k 1 {
				break;
			} break; if (k == (n - 2)) {
				System.out.print("YES");
				return;
			} k == (n - 2) k (n - 2) n 2 {
				System.out.print("YES");
				return;
			} System.out.print("YES") System.out.print System.out System System.out "YES" return; System.out.print("NO") System.out.print System.out System System.out "NO" return; String[] args args public class Main {

  public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
       
    int n = scan.nextInt();
    int[] p = new int[n];
    
    for (int i = 0; i < n; i++) {
      p[i] = scan.nextInt();
    }
    
    for (int k = 0; k < n - 1; k++) {
    	if (p[k] > p[k+1]) {
    		break;
    	} else if (k == (n - 2)) {
    		System.out.print("YES");
    		return;
    	}
    }
    
    int[] q = new int[n];
    
    for (int i = 0; i < n - 1; i++) {    
      for (int j = i + 1; j < n; j++) {
    	for (int k = 0; k < n; k++) {
			 q[k] = p[k];
		}
		q[i] = p[j];
		q[j] = p[i];
		
		for (int k = 0; k < n - 1; k++) {
			if (q[k] > q[k+1]) {
				break;
			} else if (k == (n - 2)) {
				System.out.print("YES");
				return;
			}
		}
      }
    }
    
    System.out.print("NO");
    return;
  }
} public class Main {

  public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
       
    int n = scan.nextInt();
    int[] p = new int[n];
    
    for (int i = 0; i < n; i++) {
      p[i] = scan.nextInt();
    }
    
    for (int k = 0; k < n - 1; k++) {
    	if (p[k] > p[k+1]) {
    		break;
    	} else if (k == (n - 2)) {
    		System.out.print("YES");
    		return;
    	}
    }
    
    int[] q = new int[n];
    
    for (int i = 0; i < n - 1; i++) {    
      for (int j = i + 1; j < n; j++) {
    	for (int k = 0; k < n; k++) {
			 q[k] = p[k];
		}
		q[i] = p[j];
		q[j] = p[i];
		
		for (int k = 0; k < n - 1; k++) {
			if (q[k] > q[k+1]) {
				break;
			} else if (k == (n - 2)) {
				System.out.print("YES");
				return;
			}
		}
      }
    }
    
    System.out.print("NO");
    return;
  }
} Main
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
       
    int n = scan.nextInt();
    int[] p = new int[n];
    
    for (int i = 0; i < n; i++) {
      p[i] = scan.nextInt();
    }
    
    for (int k = 0; k < n - 1; k++) {
    	if (p[k] > p[k+1]) {
    		break;
    	} else if (k == (n - 2)) {
    		System.out.print("YES");
    		return;
    	}
    }
    
    int[] q = new int[n];
    
    for (int i = 0; i < n - 1; i++) {    
      for (int j = i + 1; j < n; j++) {
    	for (int k = 0; k < n; k++) {
			 q[k] = p[k];
		}
		q[i] = p[j];
		q[j] = p[i];
		
		for (int k = 0; k < n - 1; k++) {
			if (q[k] > q[k+1]) {
				break;
			} else if (k == (n - 2)) {
				System.out.print("YES");
				return;
			}
		}
      }
    }
    
    System.out.print("NO");
    return;
  }
}
