The Little Elephant has got a problem — somebody has been touching his sorted by non-decreasing array a of length n and possibly swapped some elements of the array.

The Little Elephant doesn't want to call the police until he understands if he could have accidentally changed the array himself. He thinks that he could have accidentally changed array a, only if array a can be sorted in no more than one operation of swapping elements (not necessarily adjacent). That is, the Little Elephant could have accidentally swapped some two elements.

Help the Little Elephant, determine if he could have accidentally changed the array a, sorted by non-decreasing, himself.

Input

The first line contains a single integer n (2 ≤ n ≤ 105) — the size of array a. The next line contains n positive integers, separated by single spaces and not exceeding 109, — array a.

Note that the elements of the array are not necessarily distinct numbers.

Output

In a single line print "YES" (without the quotes) if the Little Elephant could have accidentally changed the array himself, and "NO" (without the quotes) otherwise.

Examples

Input

2
1 2


Output

YES


Input

3
3 2 1


Output

YES


Input

4
4 3 2 1


Output

NO

Note

In the first sample the array has already been sorted, so to sort it, we need 0 swap operations, that is not more than 1. Thus, the answer is "YES".

In the second sample we can sort the array if we swap elements 1 and 3, so we need 1 swap operation to sort the array. Thus, the answer is "YES".

In the third sample we can't sort the array in more than one swap operation, so the answer is "NO".
10
4 4 4 4 10 4 4 4 4 4
 5
1 3 2 3 3
 5
1 2 7 3 5
 11
2 2 2 2 2 2 2 2 2 2 1
 6
1 4 3 6 2 5
 50
6 7 8 4 10 3 2 7 1 3 10 3 4 7 2 3 7 4 10 6 8 10 9 6 5 10 9 6 1 8 9 4 3 7 3 10 5 3 10 1 6 10 6 7 10 7 1 5 9 5
 6
1 2 3 1 2 3
 9
7 7 8 8 10 10 10 10 1000000000
 5
1 4 5 2 3
 4
4 4 3 3
 2
1 1
 10
1 2 9 4 5 6 7 8 3 10
 5
1 3 3 3 2
 4
3 3 2 2
 9
1 2 3 5 4 6 7 8 9
 47
6 277 329 393 410 432 434 505 529 545 650 896 949 1053 1543 1554 1599 1648 1927 1976 1998 2141 2248 2384 2542 2638 2995 3155 3216 3355 3409 3597 3851 3940 4169 4176 4378 4378 4425 4490 4627 4986 5025 5033 5374 5453 5644
 6
6 1 2 3 4 2
 4
4 1 2 3
 4
3 4 1 2
 9
1 8 7 7 7 7 7 8 3
 100
3 7 7 8 15 25 26 31 37 41 43 43 46 64 65 82 94 102 102 103 107 124 125 131 140 145 146 150 151 160 160 161 162 165 169 175 182 191 201 211 214 216 218 304 224 229 236 241 244 249 252 269 270 271 273 289 285 295 222 307 312 317 319 319 320 321 325 330 340 341 345 347 354 356 366 366 375 376 380 383 386 398 401 407 414 417 423 426 431 438 440 444 446 454 457 458 458 466 466 472
 5
2 3 4 5 1
 4
2 1 1 1
 3
2 1 1
 6
3 4 5 6 7 2
 4
3 2 2 4
 4
2 2 1 1
 4
5 12 12 6
 4
1000000000 1 1000000000 1
 6
6 1 2 3 4 5
 5
1 2 2 1 2
 5
1 3 3 2 2
 3
1 3 2
 4
1 2 1 2
 3
3 1 2
 128
1 2 4 6 8 17 20 20 23 33 43 49 49 49 52 73 74 75 82 84 85 87 90 91 102 103 104 105 111 111 401 142 142 152 155 160 175 176 178 181 183 184 187 188 191 193 326 202 202 214 224 225 236 239 240 243 246 247 249 249 257 257 261 264 265 271 277 281 284 284 286 289 290 296 297 303 305 307 307 317 318 320 322 200 332 342 393 349 350 350 369 375 381 381 385 385 387 393 347 397 398 115 402 407 407 408 410 411 411 416 423 426 429 429 430 440 447 449 463 464 466 471 473 480 480 483 497 503
 7
3 2 1 2 3 5 4
 5
1 5 4 4 4
 5
2 2 1 3 3
 5
4 1 1 1 1
 5
3 3 3 2 2
 5
5 1 2 3 4
 4
4 2 1 3
 10
1 2 4 4 4 5 5 7 7 10
 9
3 3 3 2 2 2 1 1 1
 11
1 2 3 4 5 1 2 3 4 5 1
 10
4 5 11 12 13 14 16 16 16 18
 4
2 2 2 1
 5
3 3 1 5 4
 4
3 2 1 1
 5
1 1 3 2 2
 3
2 3 1
 5
1 4 2 2 3
 8
3 6 6 6 6 6 4 9
 6
2 2 2 2 3 2
 5
4 4 1 1 1
 5
1 2 1 1 2
 5
1 4 3 2 1
 6
4 5 3 4 2 6
 4
2 4 1 5
 20
38205814 119727790 127848638 189351562 742927936 284688399 318826601 326499046 387938139 395996609 494453625 551393005 561264192 573569187 600766727 606718722 730549586 261502770 751513115 943272321
 5
100 5 6 10 7
 4
4 5 1 1
 6
1 2 3 4 5 3
 5
1 2 5 3 4
 2
2 1
 6
1 6 2 4 3 5
 8
5 5 5 5 5 5 1 1

YES YES NO YES NO NO NO YES NO NO YES YES YES NO YES YES NO NO NO YES NO NO YES YES NO YES NO YES YES NO YES NO YES YES NO NO NO YES YES YES NO NO NO YES NO NO YES YES NO NO YES NO NO YES YES NO YES NO NO NO YES NO NO NO NO YES NO NO
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;

import java.lang.management.MemoryType;
import java.math.BigInteger;
import java.util.*;


public class Main {



        public static void main (String[]args) throws IOException {
        Scanner in = new Scanner(System.in);
        try(PrintWriter or = new PrintWriter(System.out)){

           int n = in.nextInt();
          int[] a= new int[n];
          Integer[] b = new Integer[n];
            for (int i = 0; i <n ; i++) {
                a[i]=in.nextInt();
                b[i]=a[i];
            }

            Arrays.sort(b);
            int ans=0;
            for (int i = 0; i < n; i++) {
                if (a[i]!=b[i])++ans;
            }

            or.print(ans>2?"NO":"YES");





        }


    }


    static class Scanner {

        StringTokenizer st;
        BufferedReader br;

        public Scanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

        public String next() throws IOException {
            while (st == null || !st.hasMoreTokens()) {
                st = new StringTokenizer(br.readLine());
            }
            return st.nextToken();
        }

        public int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

        public long nextLong() throws IOException {
            return Long.parseLong(next());
        }

        public String nextLine() throws IOException {
            return br.readLine();
        }

        public double nextDouble() throws IOException {
            String x = next();
            StringBuilder sb = new StringBuilder("0");
            double res = 0, f = 1;
            boolean dec = false, neg = false;
            int start = 0;
            if (x.charAt(0) == '-') {
                neg = true;
                start++;
            }
            for (int i = start; i < x.length(); i++) {
                if (x.charAt(i) == '.') {
                    res = Long.parseLong(sb.toString());
                    sb = new StringBuilder("0");
                    dec = true;
                } else {
                    sb.append(x.charAt(i));
                    if (dec) {
                        f *= 10;
                    }
                }
            }
            res += Long.parseLong(sb.toString()) / f;
            return res * (neg ? -1 : 1);
        }

        public boolean ready() throws IOException {
            return br.ready();
        }

    }
}

class prog {

    int skill;
    int indx;
    int pp;

    public prog(int skill, int indx) {
        this.skill = skill;
        this.indx = indx;
        pp = 0;
    }

    @Override
    public String toString() {
        return "prog{" + "skill=" + skill + ", indx=" + indx + ", pp=" + pp + '}';
    }

}