read n
read pstr
declare -a p=($pstr)

count=0
tigai=0
for i in ${p[@]}
do
count=$((count+1))
if test $count -ne $i
then
  tigai=$((tigai+1))
fi
done

if test $tigai -ge 3
then
  echo NO
else
  echo YES
fi

