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.
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStreamWriter;


import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map.Entry;

import java.util.Random;
import java.util.TreeSet;

public final class CF_556_D2_C
{


	static boolean verb=true;
	static void log(Object X){if (verb) System.err.println(X);}
	static void log(Object[] X){if (verb) {for (Object U:X) System.err.print(U+" ");System.err.println("");}}
	static void log(int[] X){if (verb) {for (int U:X) System.err.print(U+" ");System.err.println("");}}
	static void log(int[] X,int L){if (verb) {for (int i=0;i<L;i++) System.err.print(X[i]+" ");System.err.println("");}}
	static void log(long[] X){if (verb) {for (long U:X) System.err.print(U+" ");System.err.println("");}}

	static void logWln(Object X){if (verb) System.err.print(X);}
	static void info(Object o){	System.out.println(o);}
	static void output(Object o){outputWln(""+o+"\n");	}
	static void outputWln(Object o){try {out.write(""+ o);} catch (Exception e) {}}

	static long mod=1000000007;
	static int CX=26;

	// Global vars
	static BufferedWriter out;
	static InputReader reader;


	static class Composite implements Comparable<Composite>{
		int v;
		int idx;

		public int compareTo(Composite X) {
			if (v!=X.v)
				return v-X.v;
			return idx-X.idx;
		}

		public Composite(int v, int idx) {
			this.v = v;
			this.idx = idx;
		}

		public String toString() {
			return v+" id:"+idx;
		}
	}

	static class BIT {

		int[] tree;
		int N;

		BIT(int N){
			tree=new int[N+1];
			this.N=N;
		}

		void add(int idx,int val){
			idx++;
			while (idx<=N){
				tree[idx]+=val;
				idx+=idx & (-idx);
			}
		}

		int read(int idx){
			idx++;
			int sum=0;
			while (idx>0){
				sum+=tree[idx];
				idx-=idx & (-idx);
			}
			return sum;
		}

	}

	static boolean solve(int n,char[][] map) {
		for (int i=0;i<n;i++) {
			for (int j=0;j<n;j++) {
				if (map[i][j]=='.') {
					if (j==0 ||i==n-1||j==n-1) {
						return false;
					}
					if (map[i+1][j]!='.')
						return false;
					if (map[i+1][j+1]!='.')
						return false;
					if (map[i+1][j-1]!='.')
						return false;
					if (map[i+2][j]!='.')
						return false;
					map[i+1][j]='#';
					map[i+1][j-1]='#';
					map[i+1][j+1]='#';
					map[i+2][j]='#';
				}
			}
			
		}
		return true;
	}


	static void process() throws Exception {


		out = new BufferedWriter(new OutputStreamWriter(System.out));
		reader = new InputReader(System.in);

		int n=reader.readInt();
		
		int[] cnt=new int[3];
		for (int i=0;i<n;i++) {
			int x=reader.readInt();
			cnt[x]++;
		}
	
		if (cnt[2]>0) {
			outputWln(2+" ");
			cnt[2]--;
		}
		int mx=cnt[1];
		if (mx%2==0) {
			if (mx>0)
				mx--;
		}
		for (int i=0;i<mx;i++) {
			outputWln(1+" ");
			cnt[1]--;
		}
		while (cnt[2]>0) {
			outputWln(2+" ");
			cnt[2]--;
		}
		while (cnt[1]>0) {
			outputWln(1+" ");
			cnt[1]--;
		}
		output("");

		try {
			out.close();
		} catch (Exception e) {
		}

	}

	public static void main(String[] args) throws Exception {
		process();

	}

	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 String readString() 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 int readInt() throws IOException {
			int c = read();
			boolean neg = false;
			while (isSpaceChar(c)) {
				c = read();
			}
			char d = (char) c;
			// log("d:"+d);
			if (d == '-') {
				neg = true;
				c = read();
			}
			int res = 0;
			do {
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			// log("res:"+res);
			if (neg)
				return -res;
			return res;

		}

		public final long readLong() throws IOException {
			int c = read();
			boolean neg = false;
			while (isSpaceChar(c)) {
				c = read();
			}
			char d = (char) c;
			// log("d:"+d);
			if (d == '-') {
				neg = true;
				c = read();
			}
			long res = 0;
			do {
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			// log("res:"+res);
			if (neg)
				return -res;
			return res;

		}

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

}