#include <bits/stdc++.h>   using namespace std;   int main() {     int n, x;     int a[100000 + 3], b[100000 + 3];     cin >> n;     for (int i = 0; i < n; i++) {       cin >> a[i];       b[i] = a[i];     }     sort(b, b + n);     int cnt = 1;     for (int i = 0; i < n; i++) {       if (a[i] != b[i]) {         cnt++;       }     }     if (cnt == 3 || cnt == 1) {       cout <<  YES ;       return 0;     }     cout <<  NO ;     return 0;   }   