For this Question: You have a sequence p1, p2, p3..., pn which is a permutation of {1, 2, 3, ..., n}. You can do the following operation at most 1 time:
Choose 2 indices i and j. Swap (pi, pj).
Can you sort the permutation.The first line of the input contains an integer n, the number of elements in the permutation.
The second line contains p1, p2, ..., pn.

Constraints
2 <= n <= 100Output "YES" if it is possible to sort the permutation, else output "NO".Sample Input
5
5 2 3 4 1

Sample Output
YES

Explanation: We can swap p1, p5.

Sample Input:
5
5 1 2 4 3

Sample output:
NO, I have written this Solution Code: n=int(input())
c=0
li=list(map(int,input().strip().split()))
for i in range(1,n+1):
    if i!=li[i-1]:
        c+=1 
if c<=2:
    print("YES")
else:
    print("NO")
    
    , In this Programming Language: Python, Now tell me if this Code is compilable or not?