_,p=open(0);print(('YNEOS'[sum(i!=int(p)for i,p in enumerate(p.split(),1))>2::2]))
_,p=open(0)

i=a=0

for p in p.split():i+=1;a+=int(p)!=i

print(('YNEOS'[a>2::2]))
_, p = open(0)
print(("YNEOS"[sum(i != int(p) for i, p in enumerate(p.split(), 1)) > 2 :: 2]))

_, p = open(0)
i = a = 0
for p in p.split():
    i += 1
    a += int(p) != i
print(("YNEOS"[a > 2 :: 2]))

-print(("YNEOS"[sum(i != int(p) for i, p in enumerate(p.split(), 1)) > 2 :: 2])) +i = a = 0 +for p in p.split(): +    i += 1 +    a += int(p) != i +print(("YNEOS"[a > 2 :: 2]))