n = int(eval(input()))

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

s = sorted(p)

c = 0

for i in range(len(p)):

    if p[i] == s[i]:

        c += 1

if c >= len(p)-2:

    print('YES')

else:

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

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

l = [i+1 for i in range(n)]

c = 0

for i in range(n):

    if p[i] == l[i]:

        c += 1

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

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

-s = sorted(p) +l = [i + 1 for i in range(n)] -for i in range(len(p)): -    if p[i] == s[i]: +for i in range(n): +    if p[i] == l[i]: -if c >= len(p) - 2: -    print("YES") -else: -    print("NO") +print(("YES" if c >= n - 2 else "NO"))