Two integer sequences existed initially, one of them was strictly increasing, and another 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.

Elements of increasing sequence were inserted between elements of the decreasing one (and, possibly, before its first element and after its last element) without changing the order. For example, sequences [1, 3, 4] and [10, 4, 2] can produce the following resulting sequences: [10, 1, 3, 4, 2, 4], [1, 3, 4, 10, 4, 2]. The following sequence cannot be the result of these insertions: [1, 10, 4, 4, 3, 2] because the order of elements in the increasing sequence was changed.

Let the obtained sequence be a. This 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 another 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 into one increasing sequence and one decreasing sequence, 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 into one increasing sequence and one decreasing sequence, print "NO" in the first line.

Otherwise print "YES" in the first line. In the second line, print a sequence of n integers res_1, res_2, ..., res_n, where res_i should be either 0 or 1 for each i from 1 to n. The i-th element of this sequence should be 0 if the i-th element of a belongs to the increasing sequence, and 1 otherwise. Note that the empty sequence and the sequence consisting of one element can be considered as increasing or decreasing.

Examples

Input


9
5 1 3 6 8 2 9 0 10


Output


YES
1 0 0 0 0 1 0 1 0 


Input


5
1 2 4 0 2


Output


NO
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();
        }

    }
}

