func_code_string: #include <bits/stdc++.h>   using namespace std;   const int MAXN = 1 * 1000 + 10;   int ans[MAXN][MAXN];   int main() {     ios::sync_with_stdio(false);     int n, d, k;     cin >> n;     vector<int> a(n), b(n);     for (int i = 0; i < n; i++) {       cin >> a[i];       b[i] = a[i];     }     sort(a.begin(), a.end(), [&](int a, int b) { return a <= b; });     int ct = 0;     for (int i = 0; i < n; i++) ct = (a[i] == b[i]) ? ct : ct + 1;     if (ct == 0 || ct == 2)       cout <<  YES ;     else       cout <<  NO ;   }   