Problem: Two integer sequences existed initially — one of them was strictly increasing, and the other one — strictly decreasing.

Strictly increasing sequence is a sequence of integers [x_1 < x_2 < ... < x_k]. And strictly decreasing sequence is a sequence of integers [y_1 > y_2 > ... > y_l]. Note that the empty sequence and the sequence consisting of one element can be considered as increasing or decreasing.

They were merged into one sequence a. After that sequence a got shuffled. For example, some of the possible resulting sequences a for an increasing sequence [1, 3, 4] and a decreasing sequence [10, 4, 2] are sequences [1, 2, 3, 4, 4, 10] or [4, 2, 1, 10, 4, 3].

This shuffled sequence a is given in the input.

Your task is to find any two suitable initial sequences. One of them should be strictly increasing and the other one — strictly decreasing. Note that the empty sequence and the sequence consisting of one element can be considered as increasing or decreasing.

If there is a contradiction in the input and it is impossible to split the given sequence a to increasing and decreasing sequences, print "NO".

Input

The first line of the input contains one integer n (1 ≤ n ≤ 2 ⋅ 10^5) — the number of elements in a.

The second line of the input contains n integers a_1, a_2, ..., a_n (0 ≤ a_i ≤ 2 ⋅ 10^5), where a_i is the i-th element of a.

Output

If there is a contradiction in the input and it is impossible to split the given sequence a to increasing and decreasing sequences, print "NO" in the first line.

Otherwise print "YES" in the first line and any two suitable sequences. Note that the empty sequence and the sequence consisting of one element can be considered as increasing or decreasing.

In the second line print n_i — the number of elements in the strictly increasing sequence. n_i can be zero, in this case the increasing sequence is empty.

In the third line print n_i integers inc_1, inc_2, ..., inc_{n_i} in the increasing order of its values (inc_1 < inc_2 < ... < inc_{n_i}) — the strictly increasing sequence itself. You can keep this line empty if n_i = 0 (or just print the empty line).

In the fourth line print n_d — the number of elements in the strictly decreasing sequence. n_d can be zero, in this case the decreasing sequence is empty.

In the fifth line print n_d integers dec_1, dec_2, ..., dec_{n_d} in the decreasing order of its values (dec_1 > dec_2 > ... > dec_{n_d}) — the strictly decreasing sequence itself. You can keep this line empty if n_d = 0 (or just print the empty line).

n_i + n_d should be equal to n and the union of printed sequences should be a permutation of the given sequence (in case of "YES" answer).

Examples

Input


7
7 2 7 3 3 1 4


Output


YES
2
3 7 
5
7 4 3 2 1 


Input


5
4 3 1 5 3


Output


YES
1
3 
4
5 4 3 1 


Input


5
1 1 2 1 2


Output


NO


Input


5
0 1 2 3 4


Output


YES
0

5
4 3 2 1 0 

Solution (in JAVA):

Solution:
import java.io.*;
import java.math.BigInteger;
import java.util.*;

public class Main {
	public static void main(String[] args) throws IOException {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		PrintWriter out = new PrintWriter(outputStream);
		InputReader in = new InputReader(inputStream);
		
//		for(int i=4;i<=4;i++) {
//			String f = i+".in";
//			InputStream uinputStream = new FileInputStream("1.in");
//			InputStream uinputStream = new FileInputStream(f);
//			InputReader in = new InputReader(uinputStream);
//			PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("shortcut.out")));
			Task t = new Task();
			t.solve(in, out);
			out.close();			
//		}
	}
	
	static class Task {		
		
		public void solve(InputReader in, PrintWriter out) throws IOException {
			int n = in.nextInt();
			int arr[] = new int[n];
			for(int i=0;i<n;i++) arr[i] = in.nextInt();
			boolean pre[][] = new boolean[n][2];
			int a1 = -1; int a2 = Integer.MAX_VALUE;
			int b1 = -1; int b2 = Integer.MAX_VALUE;
			for(int i=0;i<n;i++) {
				int t = arr[i];
				int aa1 = a1;
				int aa2 = a2;
				if(t>aa1) aa1=t;
				else {
					aa1 = Integer.MAX_VALUE;
					aa2 = -1;
				}
				
				int ab1 = a1;
				int ab2 = a2;
				if(t<ab2) ab2=t;
				else {
					ab1 = Integer.MAX_VALUE;
					ab2 = -1;
				}
				
				int ba1 = b1;
				int ba2 = b2;
				if(t>ba1) ba1=t;
				else {
					ba1 = Integer.MAX_VALUE;
					ba2 = -1;
				}
				
				int bb1 = b1;
				int bb2 = b2;
				if(t<bb2) bb2=t;
				else {
					bb1 = Integer.MAX_VALUE;
					bb2 = -1;
				}
				
				if(aa1<ba1) {
					a1=aa1;
					a2=aa2;
					pre[i][0] = true;
				}else if(aa1>ba1){
					a1=ba1;
					a2=ba2;
				}else if(aa1==Integer.MAX_VALUE){
					a1 = Integer.MAX_VALUE;
					a2 = -1;
				}
				else {
					a1=aa1;
					if(aa2<ba2) {
						a2 = ba2;
					}else {
						a2=aa2;
						pre[i][0] = true;
					}
				}
				if(ab2<bb2) {
					b2=bb2;
					b1=bb1;
				}else if(ab2>bb2) {
					b2=ab2;
					b1=ab1;		
					pre[i][1] = true;
				}else if(ab2==-1) {
					b2=-1;
					b1=Integer.MAX_VALUE;
				}
				else {
					b2=ab2;
					if(bb1<ab1) {
						b1=bb1;
					}else {
						b1=ab1;
						pre[i][1] = true;
					}
				}
				if(a1!=t&&b2!=t) {
					out.println("NO");
					return;
				}
			}

			out.println("YES");
			if(a1==arr[n-1]) {
				dfs(n-1,true, pre, arr,out);
			}else {
				dfs(n-1,false,pre,arr,out);
			}
			out.println();
		}
		void dfs(int idx, boolean is_inc, boolean[][] pre, int arr[], PrintWriter out) {
			int v = is_inc?0:1;
			if(idx>0) dfs(idx-1,pre[idx][v],pre,arr,out);
			out.print(v);
			if(idx!=arr.length-1) out.print(" ");
		}
		
	    public int numDupDigitsAtMostN(int N) {
	        // Transform N + 1 to arrayList
	        ArrayList<Integer> L = new ArrayList<Integer>();
	        for (int x = N + 1; x > 0; x /= 10)
	            L.add(0, x % 10);

	        // Count the number with digits < N
	        int res = 0, n = L.size();
	        for (int i = 1; i < n; ++i)
	            res += 9 * A(9, i - 1);

	        // Count the number with same prefix
	        HashSet<Integer> seen = new HashSet<>();
	        for (int i = 0; i < n; ++i) {
	            for (int j = i > 0 ? 0 : 1; j < L.get(i); ++j)
	                if (!seen.contains(j))
	                    res += A(9 - i, n - i - 1);
	            if (seen.contains(L.get(i))) break;
	            seen.add(L.get(i));
	        }
	        return N - res;
	    }


	    public int A(int m, int n) {
	        return n == 0 ? 1 : A(m, n - 1) * (m - n + 1);
	    }		
		
	    public int numDupDigitsAtMostN2(int N) {
	    	String x = N+"";
	    	int len = x.length();
	    	int ret = 0;
	    	for(int i=1;i<len;i++) {
	    		ret+=9*A(9,i-1);
	    	}
	    	boolean seen[] = new boolean[10];
	    	for(int i=0;i<len;i++) {
	    		int idx = x.charAt(i)-'0';
	            for (int j = i > 0 ? 0 : 1; j < idx; ++j)
	                if (!seen[j])
	                    ret += A(9-i, len - i - 1);
	            if (seen[idx]) break;
	            seen[idx] = true;;
	    	}
	    	return N-ret;
	    }
	    int find(int from, int to) {
	    	int c = 0;
	    	for(int i=from; i<=to;i++) {
	    		int t = i;
	    		boolean arr[] = new boolean[10];
	    		while(t>0) {
	    			int f = t%10;
	    			if(arr[f]) {
	    				c++;
	    				break;
	    			}
	    			else arr[f] = true;
	    			t/=10;
	    		}
	    	}
	    	return c;
	    }
	    public long fa(int a) {
	    	int v = 1;
	    	for(int i=a;i>=1;i--) v*=i;
	    	return v;
	    }
//	    public long A(int m, int n) {
//	    	return fa(n)/fa(n-m);
//	    }
	    public long C(int m, int n) {
	    	return A(m,n)/fa(m);
	    }
	}
	
	class BIT{
		int arr[];
		int n;
		public BIT(int a) {
			n=a;
			arr = new int[n];
		}
		int sum(int p) {
			int s=0;
			while(p>0) {
				s+=arr[p];
				p-=p&(-p);
			}
			return s;
		}
		void add(int p, int v) {
			while(p<n) {
				arr[p]+=v;
				p+=p&(-p);
			}
		}
	}
//	static class DSU{
//		int[] arr;
//		int[] sz;
//		public DSU(int n) {
//			arr = new int[n];
//			sz = new int[n];
//			for(int i=0;i<n;i++) arr[i] = i;
//			Arrays.fill(sz, 1);
//		}
//		public int find(int a) {
//			if(arr[a]!=a) arr[a] = find(arr[a]);
//			return arr[a];
//		}
//		public void union(int a, int b) {
//			int x = find(a);
//			int y = find(b);
//			if(x==y) return;
//			arr[x] = y;
//			sz[y] += sz[x];
//		}
//		public int size(int x) {
//			return sz[find(x)];
//		}
//	}	
	static class MinHeap<Key> implements Iterable<Key> {
		private int maxN;
		private int n;
		private int[] pq;
		private int[] qp;
		private Key[] keys;
		private Comparator<Key> comparator;
		
		public MinHeap(int capacity){
			if (capacity < 0) throw new IllegalArgumentException();
			this.maxN = capacity;
			n=0;
			pq = new int[maxN+1];
			qp = new int[maxN+1];
			keys = (Key[]) new Object[capacity+1];
			Arrays.fill(qp, -1);
		}
		
		public MinHeap(int capacity, Comparator<Key> c){
			if (capacity < 0) throw new IllegalArgumentException();
			this.maxN = capacity;
			n=0;
			pq = new int[maxN+1];
			qp = new int[maxN+1];
			keys = (Key[]) new Object[capacity+1];
			Arrays.fill(qp, -1);
			comparator = c;
		}			
		public boolean isEmpty()	{ return n==0; 	}
		public int size()			{ return n;		}
		public boolean contains(int i) {
	        if (i < 0 || i >= maxN) throw new IllegalArgumentException();
	        return qp[i] != -1;
		}	
		public int peekIdx() {
	        if (n == 0) throw new NoSuchElementException("Priority queue underflow");
	        return pq[1];		
		}	
		public Key peek(){
			if(isEmpty()) throw new NoSuchElementException("Priority queue underflow");
			return keys[pq[1]];
		}
		public int poll(){
			if(isEmpty()) throw new NoSuchElementException("Priority queue underflow");
			int min = pq[1];
			exch(1,n--);
			down(1);
			assert min==pq[n+1];
			qp[min] = -1;
			keys[min] = null;		
			pq[n+1] = -1;
			return min;
		}
	    public void update(int i, Key key) {
	        if (i < 0 || i >= maxN) throw new IllegalArgumentException();
	        if (!contains(i)) {
	        	this.add(i, key);
	        }else {
	        	keys[i] = key;
	        	up(qp[i]);
	        	down(qp[i]);
	        }
	    }	
		private void add(int i, Key x){
	        if (i < 0 || i >= maxN) throw new IllegalArgumentException();
	        if (contains(i)) throw new IllegalArgumentException("index is already in the priority queue");
	        n++;
	        qp[i] = n;
	        pq[n] = i;
	        keys[i] = x;
	        up(n);
		}
		private void up(int k){
			while(k>1&&less(k,k/2)){
				exch(k,k/2);
				k/=2;
			}
		}
		private void down(int k){
			while(2*k<=n){
				int j=2*k;
				if(j<n&&less(j+1,j)) j++;
				if(less(k,j)) break;
				exch(k,j);
				k=j;
			}
		}
		
		public boolean less(int i, int j){
	        if (comparator == null) {
	            return ((Comparable<Key>) keys[pq[i]]).compareTo(keys[pq[j]]) < 0;
	        }
	        else {
	            return comparator.compare(keys[pq[i]], keys[pq[j]]) < 0;
	        }
		}

		public void exch(int i, int j){
	        int swap = pq[i];
	        pq[i] = pq[j];
	        pq[j] = swap;
	        qp[pq[i]] = i;
	        qp[pq[j]] = j;
		}

		@Override
		public Iterator<Key> iterator() {
			// TODO Auto-generated method stub
			return null;
		}
	}  	

    private static class InputReader
    {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int zcurChar;
        private int znumChars;
        private SpaceCharFilter filter;

        public InputReader(InputStream stream)
        {
            this.stream = stream;
        }

        public int read()
        {
            if (znumChars == -1)
                throw new InputMismatchException();
            if (zcurChar >= znumChars)
            {
            	zcurChar = 0;
                try
                {
                    znumChars = stream.read(buf);
                } catch (IOException e)
                {
                    throw new InputMismatchException();
                }
                if (znumChars <= 0)
                    return -1;
            }
            return buf[zcurChar++];
        }

        public int nextInt()
        {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-')
            {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do
            {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public String nextString()
        {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuilder res = new StringBuilder();
            do
            {
                res.appendCodePoint(c);
                c = read();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        public double nextDouble()
        {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-')
            {
                sgn = -1;
                c = read();
            }
            double res = 0;
            while (!isSpaceChar(c) && c != '.')
            {
                if (c == 'e' || c == 'E')
                    return res * Math.pow(10, nextInt());
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            if (c == '.')
            {
                c = read();
                double m = 1;
                while (!isSpaceChar(c))
                {
                    if (c == 'e' || c == 'E')
                        return res * Math.pow(10, nextInt());
                    if (c < '0' || c > '9')
                        throw new InputMismatchException();
                    m /= 10;
                    res += (c - '0') * m;
                    c = read();
                }
            }
            return res * sgn;
        }

        public long nextLong()
        {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-')
            {
                sgn = -1;
                c = read();
            }
            long res = 0;
            do
            {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c)
        {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public String next()
        {
            return nextString();
        }
        
        public int[] readarray(int n)
        {
        	int ret[] = new int[n];
        	for(int i=0;i<n;i++) ret[i] = this.nextInt();
        	return ret;
        }        

        public interface SpaceCharFilter
        {
            public boolean isSpaceChar(int ch);
        }
    }    

	static class Dumper {
		static void print_int_arr(int[] arr) {
			for (int i = 0; i < arr.length; i++) {
				System.out.print(arr[i] + " ");
			}
			System.out.println();
			System.out.println("---------------------");
		}

		static void print_char_arr(char[] arr) {
			for (int i = 0; i < arr.length; i++) {
				System.out.print(arr[i] + " ");
			}
			System.out.println();
			System.out.println("---------------------");
		}

		static void print_double_arr(double[] arr) {
			for (int i = 0; i < arr.length; i++) {
				System.out.print(arr[i] + " ");
			}
			System.out.println();
			System.out.println("---------------------");
		}

		static void print_2d_arr(int[][] arr, int x, int y) {
			for (int i = 0; i < x; i++) {
				for (int j = 0; j < y; j++) {
					System.out.print(arr[i][j] + " ");
				}
				System.out.println();
			}
			System.out.println();
			System.out.println("---------------------");
		}

		static void print_2d_arr(boolean[][] arr, int x, int y) {
			for (int i = 0; i < x; i++) {
				for (int j = 0; j < y; j++) {
					System.out.print(arr[i][j] + " ");
				}
				System.out.println();
			}
			System.out.println();
			System.out.println("---------------------");
		}

		static void print(Object o) {
			System.out.println(o.toString());
		}

		static void getc() {
			System.out.println("here");
		}
	}
}