#if true
//#if false
#define UTAKA_DEBUG
#endif

using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using static System.Math;


namespace UtakaApp
{
    public class Program
    {
        public static void Main(string[] args)
        {
#if UTAKA_LOCAL
            new TestCaseChecker().TestProblems();
#else
            new Program().Solve(Console.In, new ConsoleWriter());
#endif
        }

        public void Solve(TextReader textReader, IConsoleWriter consoleWriter)
        {
            var cin = new ConsoleInput(textReader, ' ');

            var n = cin.ReadInt;
            var p = cin.ReadIntArray(n);

            var pp = new int[n];

            var found = false; 

            for (int i = 0; i < n; i++)
            {
                for (int j = i; j < n; j++)
                {
                    Array.Copy(p, pp, n);

                    var tmp = pp[i];
                    pp[i] = pp[j];
                    pp[j] = tmp;

                    if (IsSorted(pp))
                    {
                        found = true;
                        break;
                    }
                }
            }

            if (found)
            {
                consoleWriter.WriteLine("YES");
            }
            else
            {
                consoleWriter.WriteLine("NO");
            }

//
//            var a = cin.ReadInt;
//            var b = cin.ReadInt;
//
//            if (a % 2 != b % 2)
//            {
//                consoleWriter.WriteLine("IMPOSSIBLE");
//            }
//            else
//            {
//                consoleWriter.WriteLine($"{(a + b) / 2}");
//            }
        }

        public bool IsSorted(int[] p)
        {
            for (int i = 1; i < p.Length; i++)
            {
                if (p[i - 1] >= p[i])
                {
                    return false;
                }
            }

            return true;
        }
    }

    public class ConsoleInput
    {
        private readonly TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;

        public ConsoleInput(TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }

        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                {
                    inputStream.Enqueue(tmp[i]);
                }

                return inputStream.Dequeue();
            }
        }

        public string ReadLine => _stream.ReadLine();
        public int ReadInt => int.Parse(Read);
        public long ReadLong => long.Parse(Read);
        public double ReadDouble => double.Parse(Read);

        public string[] ReadStrArray(long N)
        {
            var ret = new string[N];
            for (long i = 0; i < N; ++i) ret[i] = Read;
            return ret;
        }

        public int[] ReadIntArray(long N)
        {
            var ret = new int[N];
            for (long i = 0; i < N; ++i) ret[i] = ReadInt;
            return ret;
        }

        public long[] ReadLongArray(long N)
        {
            var ret = new long[N];
            for (long i = 0; i < N; ++i) ret[i] = ReadLong;
            return ret;
        }
    }

    public interface IConsoleWriter
    {
        void Write(string str);
        void WriteLine(string str);
    }

    public class ConsoleWriter : IConsoleWriter
    {
        public void Write(string str)
        {
            Console.Write(str);
        }

        public void WriteLine(string str)
        {
            Console.WriteLine(str);
        }
    }

#if UTAKA_LOCAL

    public class DebugConsoleWriter : IConsoleWriter
    {
        private StringBuilder mSb;

        public DebugConsoleWriter()
        {
            mSb = new StringBuilder();
        }

        public void Write(string str)
        {
            mSb.Append(str);
        }

        public void WriteLine(string str)
        {
            mSb.AppendLine(str);
        }

        public string GetAllOutput()
        {
            return mSb.ToString();
        }
    }

    public class TestCaseChecker
    {
        private const string ContestName = "abc135";
        private const string ProblemName = "B";
        private string DirectoryPath => $"../../../../{ContestName}/{ProblemName}";

        private string GetInputFilePath(int testCaseNumber)
        {
            return $"{DirectoryPath}/in_{testCaseNumber}.txt";
        }

        private string GetOutputFilePath(int testCaseNumber)
        {
            return $"{DirectoryPath}/out_{testCaseNumber}.txt";
        }

        public bool TestProblem(int testCaseNumber)
        {
            var inputFilePath = GetInputFilePath(testCaseNumber);
            var outputFilePath = GetOutputFilePath(testCaseNumber);

            TextReader inputStream = new StreamReader(inputFilePath);

            var debugConsoleWriter = new DebugConsoleWriter();

            try
            {
                new Program().Solve(inputStream, debugConsoleWriter);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }

            var output = debugConsoleWriter.GetAllOutput();

            TextReader outputStream = new StreamReader(outputFilePath);
            var outputAnswer = outputStream.ReadToEnd();

#if UTAKA_DEBUG
            Console.Write(output);
            Console.Write(outputAnswer);
#endif

            var isCorrect = output == outputAnswer;

            return isCorrect;
        }

        public void TestProblems()
        {
            var testCaseNumber = 1;
            while (true)
            {
                var inputFileName = GetInputFilePath(testCaseNumber);
                if (!File.Exists(inputFileName))
                {
                    break;
                }

                Console.WriteLine($"TestCase {testCaseNumber}=====================================================");

                var result = TestProblem(testCaseNumber);

                if (result)
                {
                    Console.WriteLine($"Success");
                }
                else
                {
                    Console.WriteLine($"Failure");
                }

                testCaseNumber++;
            }
        }
    }

#endif
}

Measured memory_bytes: 13268