import numpy as np

 

N = int(eval(input()))

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

 

q = sorted(p)

p, q = np.array(p), np.array(q)



if np.sum(p != q) <= 2: print('YES')

else: print('NO')
N = int(eval(input()))

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

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



ans = 0

for i in range(N):

  if p[i] != q[i]: ans += 1

    

if ans <= 2: print('YES')

else: print('NO')
import numpy as np

N = int(eval(input()))
p = list(map(int, input().split()))
q = sorted(p)
p, q = np.array(p), np.array(q)
if np.sum(p != q) <= 2:
    print("YES")
else:
    print("NO")

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

-import numpy as np - -q = sorted(p) -p, q = np.array(p), np.array(q) -if np.sum(p != q) <= 2: +q = list(range(1, N + 1)) +ans = 0 +for i in range(N): +    if p[i] != q[i]: +        ans += 1 +if ans <= 2: