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.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.IOException;
import java.io.UncheckedIOException;
import java.io.Closeable;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) throws Exception {
        Thread thread = new Thread(null, new TaskAdapter(), "", 1 << 27);
        thread.start();
        thread.join();
    }

    static class TaskAdapter implements Runnable {
        @Override
        public void run() {
            InputStream inputStream = System.in;
            OutputStream outputStream = System.out;
            FastInput in = new FastInput(inputStream);
            FastOutput out = new FastOutput(outputStream);
            TaskG solver = new TaskG();
            solver.solve(1, in, out);
            out.close();
        }
    }

    static class TaskG {
        public void solve(int testNumber, FastInput in, FastOutput out) {
            int n = in.readInt();
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = in.readInt();
            }

            int[] leftInc = new int[n];
            int[] leftDec = new int[n];
            leftInc[0] = leftDec[0] = 0;
            for (int i = 1; i < n; i++) {
                if (a[i - 1] < a[i]) {
                    leftInc[i] = leftInc[i - 1];
                } else {
                    leftInc[i] = i;
                }
                if (a[i - 1] > a[i]) {
                    leftDec[i] = leftDec[i - 1];
                } else {
                    leftDec[i] = i;
                }
            }

            boolean[][] dp = new boolean[n + 1][2];
            int[][] last = new int[n + 1][2];
            Segment seg = new Segment(0, n);
            dp[0][0] = dp[0][1] = true;
            last[0][0] = last[0][1] = -1;
            seg.updateMax(0, 0, 0, n, (int) 1e9);
            seg.updateMin(0, 0, 0, n, (int) -1e9);
            Recorder recorder = new Recorder();
            for (int i = 1; i < n; i++) {
                //inc
                recorder.init();
                seg.query(leftDec[i - 1], i - 1, 0, n, recorder);
                dp[i][0] = recorder.min < a[i];
                last[i][0] = recorder.minIndex;
                if (dp[i][0]) {
                    seg.updateMax(i, i, 0, n, a[i - 1]);
                }

                recorder.init();
                seg.query(leftInc[i - 1], i - 1, 0, n, recorder);
                dp[i][1] = recorder.max > a[i];
                last[i][1] = recorder.maxIndex;
                if (dp[i][1]) {
                    seg.updateMin(i, i, 0, n, a[i - 1]);
                }
            }
            recorder.init();
            seg.query(leftDec[n - 1], n - 1, 0, n, recorder);
            dp[n][0] = recorder.min < 1e9;
            last[n][0] = recorder.minIndex;

            recorder.init();
            seg.query(leftInc[n - 1], n - 1, 0, n, recorder);
            dp[n][1] = recorder.max > -1e9;
            last[n][1] = recorder.maxIndex;
            if (!(dp[n][0] || dp[n][1])) {
                out.println("NO");
                return;
            }
            out.println("YES");
            int type = dp[n][0] ? 0 : 1;
            int index = n;
            int[] types = new int[n];
            while (true) {
                int next = last[index][type];
                if (next < 0) {
                    break;
                }
                type = 1 - type;
                for (int j = next; j < index; j++) {
                    types[j] = type;
                }
                index = next;
            }
            for (int i = 0; i < n; i++) {
                out.append(types[i]).append(' ');
            }
        }

    }

    static class Segment implements Cloneable {
        private Segment left;
        private Segment right;
        private int max;
        private int min;
        private int minIndex;
        private int maxIndex;

        public void pushUp() {
            max = Math.max(left.max, right.max);
            min = Math.min(left.min, right.min);
            if (max == left.max) {
                maxIndex = left.maxIndex;
            } else {
                maxIndex = right.maxIndex;
            }
            if (min == left.min) {
                minIndex = left.minIndex;
            } else {
                minIndex = right.minIndex;
            }
        }

        public void pushDown() {
        }

        public Segment(int l, int r) {
            if (l < r) {
                int m = (l + r) >> 1;
                left = new Segment(l, m);
                right = new Segment(m + 1, r);
                pushUp();
            } else {
                max = (int) -1e9;
                min = (int) 1e9;
                minIndex = maxIndex = l;
            }
        }

        private boolean covered(int ll, int rr, int l, int r) {
            return ll <= l && rr >= r;
        }

        private boolean noIntersection(int ll, int rr, int l, int r) {
            return ll > r || rr < l;
        }

        public void updateMax(int ll, int rr, int l, int r, int x) {
            if (noIntersection(ll, rr, l, r)) {
                return;
            }
            if (covered(ll, rr, l, r)) {
                max = x;
                return;
            }
            pushDown();
            int m = (l + r) >> 1;
            left.updateMax(ll, rr, l, m, x);
            right.updateMax(ll, rr, m + 1, r, x);
            pushUp();
        }

        public void updateMin(int ll, int rr, int l, int r, int x) {
            if (noIntersection(ll, rr, l, r)) {
                return;
            }
            if (covered(ll, rr, l, r)) {
                min = x;
                return;
            }
            pushDown();
            int m = (l + r) >> 1;
            left.updateMin(ll, rr, l, m, x);
            right.updateMin(ll, rr, m + 1, r, x);
            pushUp();
        }

        public void query(int ll, int rr, int l, int r, Recorder recorder) {
            if (noIntersection(ll, rr, l, r)) {
                return;
            }
            if (covered(ll, rr, l, r)) {
                recorder.record(min, minIndex, max, maxIndex);
                return;
            }
            pushDown();
            int m = (l + r) >> 1;
            left.query(ll, rr, l, m, recorder);
            right.query(ll, rr, m + 1, r, recorder);
        }

    }

    static class Recorder {
        int min;
        int max;
        int minIndex;
        int maxIndex;

        public void init() {
            min = (int) 1e9;
            max = (int) -1e9;
            minIndex = maxIndex = -1;
        }

        public void record(int min, int minIndex, int max, int maxIndex) {
            if (min < this.min) {
                this.min = min;
                this.minIndex = minIndex;
            }
            if (max > this.max) {
                this.max = max;
                this.maxIndex = maxIndex;
            }
        }

    }

    static class FastInput {
        private final InputStream is;
        private byte[] buf = new byte[1 << 13];
        private int bufLen;
        private int bufOffset;
        private int next;

        public FastInput(InputStream is) {
            this.is = is;
        }

        private int read() {
            while (bufLen == bufOffset) {
                bufOffset = 0;
                try {
                    bufLen = is.read(buf);
                } catch (IOException e) {
                    bufLen = -1;
                }
                if (bufLen == -1) {
                    return -1;
                }
            }
            return buf[bufOffset++];
        }

        public void skipBlank() {
            while (next >= 0 && next <= 32) {
                next = read();
            }
        }

        public int readInt() {
            int sign = 1;

            skipBlank();
            if (next == '+' || next == '-') {
                sign = next == '+' ? 1 : -1;
                next = read();
            }

            int val = 0;
            if (sign == 1) {
                while (next >= '0' && next <= '9') {
                    val = val * 10 + next - '0';
                    next = read();
                }
            } else {
                while (next >= '0' && next <= '9') {
                    val = val * 10 - next + '0';
                    next = read();
                }
            }

            return val;
        }

    }

    static class FastOutput implements AutoCloseable, Closeable {
        private StringBuilder cache = new StringBuilder(10 << 20);
        private final Writer os;

        public FastOutput(Writer os) {
            this.os = os;
        }

        public FastOutput(OutputStream os) {
            this(new OutputStreamWriter(os));
        }

        public FastOutput append(char c) {
            cache.append(c);
            return this;
        }

        public FastOutput append(int c) {
            cache.append(c);
            return this;
        }

        public FastOutput println(String c) {
            cache.append(c).append('\n');
            return this;
        }

        public FastOutput flush() {
            try {
                os.append(cache);
                os.flush();
                cache.setLength(0);
            } catch (IOException e) {
                throw new UncheckedIOException(e);
            }
            return this;
        }

        public void close() {
            flush();
            try {
                os.close();
            } catch (IOException e) {
                throw new UncheckedIOException(e);
            }
        }

        public String toString() {
            return cache.toString();
        }

    }
}