n = int(eval(input()))

P = [int(x) for x in input().split()]

flag = True

for i in range(n):

    for j in range(n):

        if i == j:

            continue

        else:

            copy_P = P[:]

            copy_P[i], copy_P[j] = copy_P[j], copy_P[i]

            if copy_P == sorted(P):

                print("YES")

                flag = False

                break

    else:

        continue

    break

    

if sorted(P) == P:

    print("YES")

    flag = False



if flag:

    print("NO")
n = int(eval(input()))

p = [int(x) for x in input().split()]

p_copy = p[:]



p.sort()



count = 0

for i in range(n):

    if p[i] != p_copy[i]:

        count += 1



if count == 0 or count == 2:

    print("YES")

else:

    print("NO")
n = int(eval(input()))
P = [int(x) for x in input().split()]
flag = True
for i in range(n):
    for j in range(n):
        if i == j:
            continue
        else:
            copy_P = P[:]
            copy_P[i], copy_P[j] = copy_P[j], copy_P[i]
            if copy_P == sorted(P):
                print("YES")
                flag = False
                break
    else:
        continue
    break
if sorted(P) == P:
    print("YES")
    flag = False
if flag:
    print("NO")

n = int(eval(input()))
p = [int(x) for x in input().split()]
p_copy = p[:]
p.sort()
count = 0
for i in range(n):
    if p[i] != p_copy[i]:
        count += 1
if count == 0 or count == 2:
    print("YES")
else:
    print("NO")

-P = [int(x) for x in input().split()] -flag = True +p = [int(x) for x in input().split()] +p_copy = p[:] +p.sort() +count = 0 -    for j in range(n): -        if i == j: -            continue -        else: -            copy_P = P[:] -            copy_P[i], copy_P[j] = copy_P[j], copy_P[i] -            if copy_P == sorted(P): -                print("YES") -                flag = False -                break -    else: -        continue -    break -if sorted(P) == P: +    if p[i] != p_copy[i]: +        count += 1 +if count == 0 or count == 2: -    flag = False -if flag: +else: