eval(input())

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

print(('NO' if 2<sum([1 for i,j in zip(p,sorted(p)) if i!=j]) else 'YES'))
eval(input())

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

print(('YNEOS'[2<sum([1 for i,j in zip(p,sorted(p)) if i!=j])::2]))
eval(input())
(*p,) = list(map(int, input().split()))
print(("NO" if 2 < sum([1 for i, j in zip(p, sorted(p)) if i != j]) else "YES"))

eval(input())
(*p,) = list(map(int, input().split()))
print(("YNEOS"[2 < sum([1 for i, j in zip(p, sorted(p)) if i != j]) :: 2]))

-print(("NO" if 2 < sum([1 for i, j in zip(p, sorted(p)) if i != j]) else "YES")) +print(("YNEOS"[2 < sum([1 for i, j in zip(p, sorted(p)) if i != j]) :: 2]))