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.BigDecimal;
import java.math.RoundingMode;
import java.util.*;


public class Main {

    static final boolean debug = false;
    static final boolean fileIO = false;

    public static void main(String[] args) throws Exception {
        InputStream is = null;
        OutputStream os = null;
        if (fileIO) {
            is = new FileInputStream("input.txt");
            os = new FileOutputStream("output.txt");
        } else {
            is = System.in;
            os = System.out;
        }
        InputReader in = new InputReader(is);
        PrintWriter out = new PrintWriter(os);
        new Task_C().solve(in, out);
        out.close();
    }
}

class ReverseOrder {

    private void _reverse(StringBuilder s, int lo, int hi) {

    }

    public void solve(InputReader in, PrintWriter out) {
        // Поддерживаем инвариант:
        //
    }
}

class SpacesToTheEnd {

    public void solve(InputReader in, PrintWriter out) {

        // Поддерживаем инвариант:
        // S[left..right-1] => содержит только пробелы, при этом S[left - 1] != ' '
        String src = new String("the sky is blue");
        StringBuilder s = new StringBuilder(src);
        for (int left = 0, right = 0; right < s.length(); ++right) {
            if (s.charAt(right) != ' ') {
                char tmp = s.charAt(left);
                s.setCharAt(left, s.charAt(right));
                s.setCharAt(right, tmp);
                ++left;
            }
        }
        out.println(s);
        // 0123456789
        // the sky  is  blue
        // left = 3, right = 2
        // left = 3, right = 4 => swap(3,4)
        // thes ky  is  blue
    }
}

class Solution {

    public void solve(InputReader in, PrintWriter out) throws Exception {
        String s = in.nextString();
        int ans = 0;
        Map<Character, Integer> end = new HashMap<>();
        int j = 0, i = 0;
        while (j < s.length()) {
            if (end.containsKey(s.charAt(j)) && end.get(s.charAt(j)) >= i) {
                int k = end.get(s.charAt(j));
                i = k + 1;
            } else if (!end.containsKey(s.charAt(j))) {
                ans = Math.max(ans, j - i + 1);
                end.put(s.charAt(j), j);
            }
            ++j;
        }
    }
}



class Task_A {

    public void solve(InputReader in, PrintWriter out) throws Exception {
        int n = in.nextInt();
        Map<Character, Integer> m = new HashMap<>();
        for (int i = 0; i < 26; ++i) {
            m.put((char)('a' + i), i);
        }
        for (int _i = 0; _i < n; ++_i) {
            char[] s = in.nextString().toCharArray();
            ArrayList<Integer> l = new ArrayList<>();
            for (int i = 0; i < s.length; ++i) {
                l.add((int)(s[i]));
            }
            Collections.sort(l);
            boolean ans = true;
            for (int i = 0; i < l.size() - 1; ++i) {
                if (!(l.get(i + 1) - l.get(i) == 1)) {
                    ans = false;
                }
            }
            if (ans) {
                out.println("Yes");
            } else {
                out.println("No");
            }
        }
    }
}

class Task_B {

    public void solve(InputReader in, PrintWriter out) throws Exception {
        int n = in.nextInt();
        List<Integer> a = new ArrayList<>();
        int cntOdd = 0, cntEven = 0;
        int sumOdd = 0, sumEven = 0;
        List<Integer> odds = new ArrayList<>();
        List<Integer> evens = new ArrayList<>();
        for (int i = 0; i < n; ++i) {
            int el = in.nextInt();
            if (el % 2 == 0) {
                cntEven += 1;
                sumEven += el;
                evens.add(el);
            } else {
                cntOdd += 1;
                sumOdd += el;
                odds.add(el);
            }
        }
        int totalSum = sumEven + sumOdd;
        Collections.sort(evens);
        Collections.sort(odds);
        if (Main.debug) {
            System.out.print("odds ");
            for (int el : odds) {
                System.out.print(el + " ");
            }
            System.out.println();
            System.out.print("evens ");
            for (int el : evens) {
                System.out.print(el + " ");
            }
            System.out.println();
        }
        // Case (1). Starts with odd number
        int i = odds.size() - 1;
        int j = evens.size() - 1;
        int ans1 = 0;
        boolean light = true;
        while (i >= 0 && j >= 0) {
            if (light) {
                ans1 += odds.get(i--);
                light = false;
            } else {
                ans1 += evens.get(j--);
                light = true;
            }
        }
        if (light && i >= 0) {
            ans1 += odds.get(i--);
        }
        if (!light && j >= 0) {
            ans1 += evens.get(j--);
        }
        if (Main.debug) {
            System.out.println("ans1 = " + ans1);
        }

        // Case (2). Starts with even number
        int ans2 = 0;
        i = evens.size() - 1;
        j = odds.size() - 1;
        light = true;
        while (i >= 0 && j >= 0) {
            if (light) {
                ans2 += evens.get(i--);
                light = false;
            } else {
                ans2 += odds.get(j--);
                light = true;
            }
        }
        if (light && i >= 0) {
            ans2 += evens.get(i--);
        }
        if (!light && j >= 0) {
            ans2 += odds.get(j--);
        }

        if (Main.debug) {
            System.out.println("ans2 = " + ans2);
        }
        int ans = Math.max(ans1, ans2);
        out.println(totalSum - ans);

    }
}

class Task_C {

    public void solve(InputReader in, PrintWriter out) throws Exception {
        int n = in.nextInt();
        ArrayList<Integer> a = new ArrayList<>();
        Map<Integer, Integer> m = new HashMap<>();
        boolean isOk = true;
        for (int i = 0; i < n; ++i) {
            int el = in.nextInt();
            m.putIfAbsent(el, 0);
            m.put(el, m.get(el) + 1);
            if (m.get(el) >= 3) {
                isOk = false;
            }
        }
        ArrayList<Integer> inc = new ArrayList<>();
        ArrayList<Integer> dec = new ArrayList<>();
        for (Integer key : m.keySet()) {
            if (m.get(key) > 1) {
                inc.add(key);
                dec.add(key);
            } else {
                inc.add(key);
            }
        }
        if (isOk) {
            out.println("YES");
            out.println(inc.size());
            Collections.sort(inc);
            for (int i = 0; i < inc.size(); ++i) {
                out.print(inc.get(i));
                if (i < inc.size() - 1) {
                    out.print(" ");
                }
            }
            out.println();
            out.println(dec.size());
            Collections.sort(dec);
            if (dec.size() == 0) {
                out.println("");
            } else {
                for (int i = dec.size() - 1; i >= 0; --i) {
                    out.print(dec.get(i));
                    if (i > 0) {
                        out.print(" ");
                    }
                }
                out.println();
            }
        } else {
            out.println("NO");
        }
    }
}

class Task_D {

    public void solve(InputReader in, PrintWriter out) throws Exception {
        int n = in.nextInt();
        ArrayList<Integer> a = new ArrayList<>();
        Map<Integer, Integer> cnt = new HashMap<>();
        for (int i = 0; i < n; ++i) {
            int el = in.nextInt();
            cnt.putIfAbsent(el, 0);
            cnt.put(el, cnt.get(el) + 1);
        }
        int maxF = 0;
        int maxV = 0;
        for (int key : cnt.keySet()) {
            if (cnt.get(key) > maxF) {
                maxF = cnt.get(key);
                maxV = key;
            }
        }
    }
}

class FactorialCalculation {

    long f(long num) {
        if (num == 1) {
            return 1;
        }
        System.out.println("Я не знаю как посчитать f(" + num + ")");
        long ans = f(num - 1);
        System.out.println("Я знаю как посчитать f(" + num + ")");
        return num * ans;
    }

    void gg(int c, int id) {
        if (id == c + 1) {
            return;
        }
        System.out.println(id);
        gg(c, id + 1);
        System.out.println(id);
    }

    public void solve(InputReader in, PrintWriter out) {
        gg(5, 1);
    }
}

class PrintElementsOfArray {

    void printElement(int[] ar, int id) {
        if (id == ar.length) {
            return;
        } else {
            System.out.print(ar[id] + " ");
            printElement(ar, id + 1);
        }
    }

    public void solve(InputReader in, PrintWriter out) {
        int[] array = {1,2,3,4};
        printElement(array, 0);
    }
}

class CalculateLengthOfString {

    int lengthOfString(char[] a, int id) {
        if (a[id] == '\0') {
            return 0;
        }

        int ans = lengthOfString(a, id + 1);
        return ans + 1;
    }

    public void solve(InputReader in, PrintWriter out) {
        char[] s = { 'a', 'b', 'c', 'd', '\0' };
        int answer = lengthOfString(s, 0);
        System.out.println(answer);
//        int i = 0;
//        while (s[i] != '\0') {
//            i++;
//        }
//        System.out.println(i);


        // s = abcd
    }
}

class RaiseToPower {


    public int f(int num, int level) {
        if (level == 0) {
            System.out.println();
            System.out.println("level = 0. Но мы то знаем, что любое число в степени 0 = 1. Просто возвращаю результат");
            System.out.println();
            return 1;
        }
        System.out.println();
        System.out.println("level > 0. Level = " + level);
        System.out.println("Значит вычисляю сначала " + "f(" + num + "," + (level - 1) + ")");
        System.out.println();
        int x = f(num, level - 1);
        System.out.println();
        System.out.println("Супер. Результат от вычисения f(" + num + "," + (level - 1) + ") я завершил. Значит теперь могу вычислить " +
                "f(" + num + "," + (level) + ")");
        System.out.println();
        return x * num;
    }
    /*
    1. 2^5 (5 > 0) -> no => ans = 5 * f(2,5-1)
    2. 2^4 (4 > 0) -> no => ans = 4 * f(2,4-1)
    3. 2^3 (3 > 0) -> no => ans = 3 * f(2,3-1)
    4. 2^2 (2 > 0) -> no => ans = 2 * f(2,2-1)
    5. 2^1 (1 > 0) -> no => ans = 2 * f(2,1-1)
    6. 2^0 (0 > 0) -> no => ans = 1 (level == 0) => return 1;


     */

    public void solve(InputReader in, PrintWriter out) throws Exception {
        int num = 3;
        int power = 5;
        out.println(f(num, power));
    }
}

class Fibonacci {

    long fib(int n) {
        System.out.println();
        System.out.println("Пробую вычислить число Фиббоначи на позиции: " + n);
        if (n == 1 || n == 2) {
            System.out.println();
            System.out.println("Ага, какое число фиббоначи стоит на первом или втором месте я знаю => возвращаю ответ 1");
            return 1;
        }
        System.out.println("К сожалению, на данный момент я пока не могу вычислить " + n + "-e" + " число Фиббоначи, ибо не знаю предыдущих всех");
        long fib1 = fib(n - 1);
        long fib2 = fib(n - 2);
        System.out.println();
        System.out.println("Теперь у меня все данные, чтобы посчитать " + n + "–е " + "число Фиббоначи");
        System.out.println("И я просто беру его, считаю и возвращаю ответ выше => " + (fib1 + fib2));
        return fib1 + fib2;
    }


    public void solve(InputReader in, PrintWriter out) throws Exception {
        System.out.println(fib(5));
    }
}




class SpiralMatrix {

    // N = 3
    // 1 2 3
    // 8 9 4
    // 7 6 5



    void fillLayer(int level, int[][] a, int cnt) {
        // level = 0 => a[0][0] = 1, a[0][1] = 2, a[0][2] = 3, ... , a[0][n - 1] = n
        // a[1][n-1] = n + 1, a[2][n-2] = n + 2, ... ,
        // БЕЗ РЕКУРСИИ !!!
    }

    void f(int[][] a, int level, int NUMBER_OF_LAYERS, int cnt) {
        if (level >= NUMBER_OF_LAYERS) {
            return;
        } else {
            // На текущем слое @level мы будем заполнять его начиная с числа @cnt

        }
    }

    public void solve(InputReader in, PrintWriter out) throws Exception {
        int n = in.nextInt();
        int[][] a = new int[n][n];
        int NUMBER_OF_LAYERS = n / 2 + n % 2;
        f(a, 0, NUMBER_OF_LAYERS, 1);
        //
    }
}

class AllCombinationsOfGivenSum {



    public void solve(InputReader in, PrintWriter out) {

    }
}

class PrintArray {


    void upper(int id, int[] a, int n) {
        if (id == n) {
            return;
        } else {
            System.out.print(a[id] + " ");
            upper(id + 1, a, n);
        }
    }

    // Output: a[0], a[1], ... , a[n - 1]

    void downer(int id, int[] a, int n) {
        if (id == n) {
            return;
        } else {
            downer(id + 1, a, n);
            System.out.print(a[id] + " ");
        }
    }

    // Output: a[n - 1], a[n - 2], ... , a[0]

    public void solve(InputReader in, PrintWriter out) throws IOException {

        int[] a = {10, 15, 20};
    }
}

class Steps {

    // N = 2
    // '# '
    // '##'

    // N = 4
    // '#   '
    // '##  '
    // '### '
    // '####'

    void printCells(int k, int n) {
        // ###
        for (int i = 0; i < k; ++i) {
            System.out.print('#');
        }
        // what should i
        for (int i = 0; i < (n - k); ++i) {
            System.out.print(' ');
        }
        System.out.println();
    }

    void Hashtag(int n, int id) {
        if (id == n) {
            return;
        }
        printCells(id + 1, n); // вывод на ОДНУ строчку РОВНО (n - id) '#' and (id) ' '
        Hashtag(n, id + 1);
        //
    }



    public void solve(InputReader in, PrintWriter out) throws Exception {
        int n = in.nextInt();
        Hashtag(n, 0);
    }
}




class SegmentTree {

    private static long NIL = Long.MAX_VALUE;

    public interface Function {
        public long value(long a, long b);
    }

    private Function f;

    private long[] tree;
    private int n;

    public SegmentTree(int[] array, Function f) {
        this.f = f;
        this.n = array.length;
        int sz = 1;
        while (sz < n) sz <<= 1;
        this.tree = new long[sz + (sz - 1)];
        build(array, 0, 0, n - 1);
    }

    private void build(int[] array, int id, int lo, int hi) {
        if (lo == hi) {
            tree[id] = array[lo];
        } else {
            int m = (lo + hi) >> 1;
            build(array, 2 * id + 1, lo, m);
            build(array, 2 * id + 2, m + 1, hi);
            tree[id] = f.value(tree[2 * id + 1], tree[2 * id + 2]);
        }
    }

    public long query(int i, int j) {
        return query(0, 0, n - 1, i, j);
    }
    private long query(int id, int lo, int hi, int i, int j) {
        if (i <= lo && hi <= j) {
            return tree[id];
        }
        if (lo > j || hi < i) {
            return NIL;
        }
        int m = (lo + hi) >> 1;
        int l_id = 2 * id + 1;
        int r_id = 2 * id + 2;
        if (j <= m) {
            return query(l_id, lo, m, i, j);
        }
        if (i > m) {
            return query(r_id, m + 1, hi, i, j);
        }
        return f.value(query(l_id, lo, m, i, j), query(r_id, m + 1, hi, i, j));
    }

    // @a[i] = value
    public void update(int i, int value) {
        update(0, 0, n - 1, i, value);
    }
    //
    private void update(int id, int lo, int hi, int i, int value) {
        if (lo == hi) {
            tree[id] = value;
        } else {
            int m = (lo + hi) >> 1;
            int l_id = 2 * id + 1;
            int r_id = 2 * id + 2;
            if (i <= m) {
                update(l_id, lo, m, i, value);
            } else {
                update(r_id, m + 1, hi, i, value);
            }
            tree[id] = f.value(tree[l_id], tree[r_id]);
        }
    }
}

class InputReader {

    class EOF extends Exception {
        public EOF(String msg) {
            super(msg);
        }
    }

    private InputStream stream;
    private byte[] buf;
    private int curChar = 0, snumChars = 0;

    private SpaceCharFilter filter;

    public InputReader(InputStream stream) {
        this.stream = stream;
        this.buf = new byte[8192];
        this.filter = null;
    }

    public void setSpaceCharFilter(SpaceCharFilter filter) {
        this.filter = filter;
    }


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

    public int nextInt() throws EOF, InputMismatchException {
        int c = snext();
        while (isSpaceChar(c) && c != -1) {
            c = snext();
        }
        if (c == -1) {
            throw new EOF("End of file");
        }
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = snext();
        }
        int res = 0;
        while (!isSpaceChar(c)) {
            if (c < '0' || c > '9') {
                throw new InputMismatchException();
            }
            res *= 10;
            res += c - '0';
            c = snext();
        }
        return res * sgn;
    }

    public double nextDouble() throws EOF, InputMismatchException {
        return Double.parseDouble(nextString());
    }

    public long nextLong() throws EOF, InputMismatchException {
        return Long.parseLong(nextString());
    }

    public String nextString() throws InputMismatchException, EOF {
        int c = snext();
        while (isSpaceChar(c) && c != -1) {
            c = snext();
        }
        if (c == -1) {
            throw new EOF("End of file");
        }
        StringBuilder res = new StringBuilder();
        do {
            res.appendCodePoint(c);
            c = snext();
        } while (!isSpaceChar(c));
        return res.toString();
    }



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

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