import numpy as np

N = int(eval(input()))

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

cnt = 0

org=np.arange(1,N+1,1)

for n in range(N):

    if org[n] != p[n]:

        cnt += 1

print(('NO' if cnt>2 else 'YES'))
N = int(eval(input()))

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

cnt = 0

org=list(range(1,N+1))

for n in range(N):

    if org[n] != p[n]:

        cnt += 1

print(('NO' if cnt>2 else 'YES'))
import numpy as np

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

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

-import numpy as np - -org = np.arange(1, N + 1, 1) +org = list(range(1, N + 1))