"use strict"

function isSortable(args, sorted_args){
  let not_match_cnt = 0
  sorted_args.map((item, key)=>{
    if(sorted_args[key] != args[key]){
      not_match_cnt++
    }
  })
  if(not_match_cnt == 0 || not_match_cnt == 2){
    return true
  }else{
    return false
  }
}

const arg_str = require('fs').readFileSync('/dev/stdin', 'UTF-8')
const YES = 'YES'
const NO = 'NO'
const args= arg_str.split(' ')
if(Math.min(...args) < 2 ||  50 < Math.max(...args)){
  console.log(NO)
  return
}
const args_asc = args.slice().sort((a,b)=>a-b)
const args_desc = args.slice().sort((a,b)=>b-a)

const is_sortable_asc = isSortable(args, args_asc)
const is_sortable_desc = isSortable(args, args_desc)

if(is_sortable_asc || is_sortable_desc){
  console.log(YES)
}else{
  console.log(NO)
}