program bbb
implicit none

integer :: i, j, k, n, dumy
integer, allocatable, dimension(:) :: p
logical :: found

read(*,*) n
allocate(p(n))
read(*,*) p

do i=1,n
 do J=i,n
 dumy=p(i)
 p(i)=p(j)
 p(j)=dumy
 found=.True.
  do k=1,n-1
  if(p(k)>=p(k+1)) then
  found=.False.
  end if
  end do
 if (found) then
 write(*,'(a3)') 'YES'
 return
 end if
 dumy=p(i)
 p(i)=p(j)
 p(j)=dumy
 end do
end do

write(*,'(a2)') 'NO'

end program