We're giving away nice huge bags containing number tiles! A bag we want to present to you contains n tiles. Each of them has a single number written on it — either 1 or 2.

However, there is one condition you must fulfill in order to receive the prize. You will need to put all the tiles from the bag in a sequence, in any order you wish. We will then compute the sums of all prefixes in the sequence, and then count how many of these sums are prime numbers. If you want to keep the prize, you will need to maximize the number of primes you get.

Can you win the prize? Hurry up, the bags are waiting!

Input

The first line of the input contains a single integer n (1 ≤ n ≤ 200 000) — the number of number tiles in the bag. The following line contains n space-separated integers a_1, a_2, ..., a_n (a_i ∈ \{1, 2\}) — the values written on the tiles.

Output

Output a permutation b_1, b_2, ..., b_n of the input sequence (a_1, a_2, ..., a_n) maximizing the number of the prefix sums being prime numbers. If there are multiple optimal permutations, output any.

Examples

Input


5
1 2 1 2 1


Output


1 1 1 2 2


Input


9
1 1 2 1 1 1 2 1 1


Output


1 1 1 2 1 1 1 2 1

Note

The first solution produces the prefix sums 1, \mathbf{\color{blue}{2}}, \mathbf{\color{blue}{3}}, \mathbf{\color{blue}{5}}, \mathbf{\color{blue}{7}} (four primes constructed), while the prefix sums in the second solution are 1, \mathbf{\color{blue}{2}}, \mathbf{\color{blue}{3}}, \mathbf{\color{blue}{5}}, 6, \mathbf{\color{blue}{7}}, 8, 10, \mathbf{\color{blue}{11}} (five primes). Primes are marked bold and blue. In each of these cases, the number of produced primes is maximum possible.

/*
 * Code Author: Akshay Miterani
 * DA-IICT
 */
import java.io.*;
import java.math.*;
import java.util.*;

public class Main {

    InputReader in;
    PrintWriter out;

    Main() throws IOException {
        in = new InputReader(System.in);
        out = new PrintWriter(System.out);
        // in = new InputReader(new FileInputStream("output_.txt"));
        // out = new PrintWriter(new File("output_.txt"));
        solve();
        out.close();
    }

    public static void main(String args[]) {
        new Thread(null, new Runnable() {
            public void run() {
                try {
                    new Main();
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        }, "1", 1 << 26).start();
    }

    // --------------------My Code Starts Here----------------------
    int mod = (int) 1e9 + 7;
    long ans = Long.MAX_VALUE;

    public void solve() throws IOException {
        int n = in.nextInt();
        int a[] = in.readIntBrray(n);
        int c1 = 0, c2 = 0;
        for (int x : a) {
            if (x == 1) {
                c1++;
            } else {
                c2++;
            }
        }
        int MAX = 4 * (int) 1e5 + 6;
        boolean c[] = new boolean[MAX];
        c[0] = c[1] = true;
        for (int i = 2; i < MAX; i++) {
            if (!c[i])
                for (int j = 2; i * j < MAX; j++) {
                    c[i * j] = true;
                }
        }
        int sum = 0;
        int ans[] = new int[n];
        for (int i = 0; i < n; i++) {
            if (!c[sum + 2] && c2 > 0) {
                ans[i] = 2;
                c2--;
            } else if (!c[sum + 1] && c1 > 0) {
                ans[i] = 1;
                c1--;
            } else if (c2 > 0) {
                ans[i] = 2;
                c2--;
            } else if (c1 > 0) {
                ans[i] = 1;
                c1--;
            }
            sum += ans[i];
        }
        for (int x : ans) {
            out.print(x + " ");
        }
        out.println();
    }

    // ---------------------My Code Ends Here------------------------
    void sol(int r[], int b[], int g[]) {
        for (int i = 0; i < r.length; i++) {
            int value = r[i];
            int f_u = upper(g, value);
            int f_l = f_u - 1;

            int s_u = upper(b, value);
            int s_l = s_u - 1;

            long vf_u = g[f_u];
            long vf_l = f_l < 0 ? g[0] : g[f_l];

            long vs_u = b[s_u];
            long vs_l = s_l < 0 ? b[0] : b[s_l];

            ans = Math.min(ans, cal(vf_l, value, vs_l));
            ans = Math.min(ans, cal(vf_l, value, vs_u));
            ans = Math.min(ans, cal(vf_u, value, vs_l));
            ans = Math.min(ans, cal(vf_u, value, vs_u));
        }
    }

    long cal(long x, long y, long z) {
        return (x - y) * (x - y) + (y - z) * (y - z) + (z - x) * (z - x);
    }

    // First value greater than or equal to the mid
    public static int upper(int[] array, int value) {
        int low = 0;
        int high = array.length - 1;
        while (low <= high) {
            final int mid = (low + high) / 2;
            // checks if the value is less than middle element of the array
            if (value < array[mid]) {
                high = mid - 1;
            } else {
                low = mid + 1;
            }
        }
        if (low >= array.length) {
            low = array.length - 1;
        }
        return low;
    }

    static class Pair implements Comparable<Pair> {
        int x;
        int y;
        int i;
        long size;
        int pos;

        Pair(int xx, int yy) {
            x = xx;
            y = yy;
        }

        @Override
        public int compareTo(Pair o) {
            if (Long.compare(this.x, o.x) != 0)
                return -Long.compare(this.x, o.x);
            else
                return Long.compare(this.y, o.y);
        }
    }

    public static void debug(Object... o) {
        System.out.println(Arrays.deepToString(o));
    }

    static final class InputReader {
        private final InputStream stream;
        private final byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;

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

        private int read() throws IOException {
            if (curChar >= numChars) {
                curChar = 0;
                numChars = stream.read(buf);
                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public final int nextInt() throws IOException {
            return (int) nextLong();
        }

        public final long nextLong() throws IOException {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
                if (c == -1)
                    throw new IOException();
            }
            boolean negative = false;
            if (c == '-') {
                negative = true;
                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 negative ? (-res) : (res);
        }

        public final int[] readIntBrray(int size) throws IOException {
            int[] arr = new int[size];
            for (int i = 0; i < size; i++)
                arr[i] = nextInt();
            return arr;
        }

        public final String next() throws IOException {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuilder res = new StringBuilder();
            do {
                res.append((char) c);
                c = read();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        public final String nextLine() throws IOException {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuilder res = new StringBuilder();
            do {
                res.append((char) c);
                c = read();
            } while (c != '\n' && c != -1);
            return res.toString();
        }

        private boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }
    }
}