eval(input())

g = eval(input())

a = list(map(str, g.split()))

b = list(map(int, g.split()))

if sorted(b) == b:

    print("YES")

else:

    m = 0

    for i in range(len(b)):

        if b[i] == sorted(b)[i]:

            m+=1

    if m==len(b)-2:

        print("YES")

    else:

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

p = list(map(int, input().split()))

c = 0

for i in range(n):

    if p[i]!=i+1:

        c+=1

if c>2:

    print("NO")

else:

    print("YES")
eval(input())
g = eval(input())
a = list(map(str, g.split()))
b = list(map(int, g.split()))
if sorted(b) == b:
    print("YES")
else:
    m = 0
    for i in range(len(b)):
        if b[i] == sorted(b)[i]:
            m += 1
    if m == len(b) - 2:
        print("YES")
    else:
        print("NO")

n = int(eval(input()))
p = list(map(int, input().split()))
c = 0
for i in range(n):
    if p[i] != i + 1:
        c += 1
if c > 2:
    print("NO")
else:
    print("YES")

-eval(input()) -g = eval(input()) -a = list(map(str, g.split())) -b = list(map(int, g.split())) -if sorted(b) == b: +n = int(eval(input())) +p = list(map(int, input().split())) +c = 0 +for i in range(n): +    if p[i] != i + 1: +        c += 1 +if c > 2: +    print("NO") +else: -else: -    m = 0 -    for i in range(len(b)): -        if b[i] == sorted(b)[i]: -            m += 1 -    if m == len(b) - 2: -        print("YES") -    else: -        print("NO")