{"raw_statement":[{"iden":"problem statement","content":"We have a sequence $p$ = {$p_1,\\ p_2,\\ ...,\\ p_N$} which is a permutation of {$1,\\ 2,\\ ...,\\ N$}.\nYou can perform the following operation at most once: choose integers $i$ and $j$ $(1 \\leq i < j \\leq N)$, and swap $p_i$ and $p_j$. Note that you can also choose not to perform it.\nPrint `YES` if you can sort $p$ in ascending order in this way, and `NO` otherwise."},{"iden":"constraints","content":"*   All values in input are integers.\n*   $2 \\leq N \\leq 50$\n*   $p$ is a permutation of {$1,\\ 2,\\ ...,\\ N$}."},{"iden":"input","content":"Input is given from Standard Input in the following format:\n\n$N$\n$p_1$ $p_2$ $...$ $p_N$"},{"iden":"sample input 1","content":"5\n5 2 3 4 1"},{"iden":"sample output 1","content":"YES\n\nYou can sort $p$ in ascending order by swapping $p_1$ and $p_5$."},{"iden":"sample input 2","content":"5\n2 4 3 5 1"},{"iden":"sample output 2","content":"NO\n\nIn this case, swapping any two elements does not sort $p$ in ascending order."},{"iden":"sample input 3","content":"7\n1 2 3 4 5 6 7"},{"iden":"sample output 3","content":"YES\n\n$p$ is already sorted in ascending order, so no operation is needed."}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}