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".
import java.io.*;
import java.math.BigInteger;
import java.util.*;

/**
 * 
 * @author Saju
 *
 */

public class Main {

	static int[] dx = { 0, 1, 0, -1 };
	static int[] dy = { -1, 0, 1, 0 };

	public static void main(String[] args) {

		InputReader in = new InputReader(System.in);

		int n = in.nextInt();
		int arr[] = new int[n];
		int brr[] = new int[n];
		for(int i = 0; i < n; i++){
			arr[i] = in.nextInt();
			brr[i] = arr[i];
		}
		
		Arrays.sort(brr);
		
		int count = 0;
		for(int i = 0; i < n; i++){
			if(arr[i] != brr[i]){
				count++;
			}
			
			if(count > 2){
				break;
			}
		}
		
		if(count <= 2){
			System.out.println("YES");
		}
		else{
			System.out.println("NO");
		}
		
		
		
		System.exit(0);

	}
	
	

	private static double getDistance(double x1, double y1, double x2, double y2) {
		
		return Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2);
	}



	private static int getDecimal(String str) {
		int val = 0;
		
		for(int i = str.length() - 1, j = 0; i >= 0; i--, j++){
			if(str.charAt(i) == '1'){
				val += Math.pow(2, j);
			}
		}
		return val;
	}



	private static int call(int i, int j, int[][] colors) {

		if (i >= colors.length) {
			return 0;
		}

		if (dp[i][j] != -1) {
			return dp[i][j];

		}

		int result = Integer.MAX_VALUE;

		for (int k = 0; k < 3; k++) {
			if (k == j) {
				continue;
			} else {
				result = Math.min(result, call(i + 1, k, colors) + colors[i][j]);
			}
		}

		return dp[i][j] = result;
	}

	static int dp[][];

	private static class Graph {

		List<Edge> adjList[];
		int v;
		boolean visited[];
		int first[];
		int second[];

		Graph(int n) {
			this.v = n;
			adjList = new ArrayList[n];
			visited = new boolean[n];
			first = new int[n];
			second = new int[n];

			for (int i = 0; i < n; i++) {
				adjList[i] = new ArrayList<>();
			}
		}

		public void addEdge(int u, int v, int w) {
			adjList[u].add(new Edge(u, v, w));
			adjList[v].add(new Edge(v, u, w));
		}

		private void bfsAnother(int source) {
			Arrays.fill(visited, false);
			visited[source] = true;
			Queue<Integer> queue = new LinkedList<>();
			queue.add(source);
			second[source] = 0;

			while (!queue.isEmpty()) {
				int u = queue.remove();

				for (Edge e : adjList[u]) {
					if (!visited[e.v]) {
						queue.add(e.v);
						visited[e.v] = true;
						second[e.v] = second[u] + e.w;
					}
				}
			}
		}

		int firstFarthest;

		private void bfs(int source) {
			Arrays.fill(visited, false);
			visited[source] = true;
			Queue<Integer> queue = new LinkedList<>();
			queue.add(source);
			int max = 0;
			first[source] = 0;

			while (!queue.isEmpty()) {
				int u = queue.remove();
				if (first[u] > max) {
					max = first[u];
					firstFarthest = u;
				}
				for (Edge e : adjList[u]) {
					if (!visited[e.v]) {
						queue.add(e.v);
						visited[e.v] = true;
						first[e.v] = first[u] + e.w;
					}
				}
			}
		}

		public int dfs(int source) {

			visited[source] = true;
			int val = 0;
			int max = 0;
			for (Edge e : adjList[source]) {
				val = 0;
				if (!visited[e.v]) {
					val += (e.w + dfs(e.v));
				}
				max = Math.max(val, max);
			}

			return max;
		}
	}

	private static class Edge {
		int u;
		int v;
		int w;

		Edge(int u, int v, int w) {
			this.u = u;
			this.v = v;
			this.w = w;
		}
	}

	private static BigInteger fac(int n, int mod) {

		if (n <= 0) {
			return BigInteger.ONE;
		}
		return BigInteger.valueOf(n).multiply(fac(n - 1, mod));
	}

	private static long bigMod(long n, long k, long m) {

		long ans = 1;
		while (k > 0) {
			if ((k & 1) == 1) {
				ans = (ans * n) % m;
			}
			n = (n * n) % m;
			k >>= 1;
		}
		return ans;
	}

	private static int upperBound(long[] arr, long num) {

		int start = 0;
		int end = arr.length;

		int mid = 0;
		int index = 0;
		while (true) {

			if (start > end) {
				break;
			}
			mid = (start + end) / 2;
			if (arr[mid] > num) {
				end = mid - 1;

			} else if (arr[mid] < num) {
				start = mid + 1;
			} else {
				return mid;
			}

		}

		// System.out.println(mid);
		if (arr[mid] < num) {
			index = mid + 1;
		} else {
			index = mid;
		}
		return index;
	}

	static class InputReader {
		public BufferedReader reader;
		public StringTokenizer tokenizer;

		public InputReader(InputStream stream) {
			reader = new BufferedReader(new InputStreamReader(stream));
			tokenizer = null;
		}

		public String next() {
			try {
				while (tokenizer == null || !tokenizer.hasMoreTokens()) {
					tokenizer = new StringTokenizer(reader.readLine());

				}
			} catch (IOException e) {
				return null;
			}
			return tokenizer.nextToken();
		}

		public String nextLine() {
			String line = null;
			try {
				tokenizer = null;
				line = reader.readLine();
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
			return line;
		}

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

		public double nextDouble() {
			return Double.parseDouble(next());
		}

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

		public boolean hasNext() {
			try {
				while (tokenizer == null || !tokenizer.hasMoreTokens()) {
					tokenizer = new StringTokenizer(reader.readLine());
				}
			} catch (Exception e) {
				return false;
			}
			return true;
		}
	}
}
			 	  		   		 	 		 						 	 	