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

public class C implements Runnable {
	public static void main (String[] args) {new Thread(null, new C(), "_cf", 1 << 28).start();}
	
	public void run() {
		FastScanner fs = new FastScanner();
		PrintWriter out = new PrintWriter(System.out);
		System.err.println("");
		
		int MAX = 500500;
		int[] primes = new int[MAX];
		boolean[] isPrime = new boolean[MAX];
		Arrays.fill(isPrime, true);
		isPrime[1] = false;
		int ptr = 0;
		for(int i = 2; i < MAX; i++) {
			if(!isPrime[i]) continue;
			primes[ptr++] = i;
			for(int j = 2 * i; j < MAX; j += i) {
				isPrime[j] = false;
			}
		}
		primes = Arrays.copyOfRange(primes, 0, ptr);

		int n = fs.nextInt();
		int numOnes = 0, numTwos = 0;
		for(int i = 0; i < n; i++) {
			int x = fs.nextInt();
			if(x == 1) numOnes++;
			else numTwos++;
		}
		int[] res = new int[n];
		int cnt = 0;
		for(int i = 0, sum = 0; i < n; i++) {
			if(numOnes > i) {
				res[i] = 1;
				sum++;
			}
			else {
				res[i] = 2;
				sum += 2;
			}
			if(isPrime[sum]) cnt++;
		}
		if(numOnes > 2) {
			int oc = numOnes, tc = numTwos;
			int[] r1 = new int[n];
			int ret = 2;
			r1[0] = r1[1] = r1[2] = 1;
			oc -= 3;
			int sum = 3;
			for(int i = 3; i < n; i++) {
				if(tc > 0) {
					r1[i] = 2;
					sum += 2;
					tc--;
				}
				else {
					sum++;
					r1[i] = 1;
				}
				if(isPrime[sum]) ret++;
			}
			if(ret > cnt) {
				cnt = ret;
				res = r1;
			}
		}
		if(numOnes > 0 && numTwos > 0) {
			int oc = numOnes, tc = numTwos;
			int[] r1 = new int[n];
			r1[0] = 2; r1[1] = 1; oc--; tc--;
			int sum = 3; int ret = 2;
			for(int i = 2; i < n; i++) {
				if(tc > 0) {
					sum += 2;
					r1[i] = 2; tc--;
				}
				else {
					sum++;
					r1[i] = 1;
				}
				if(isPrime[sum]) ret++;
			}
			if(ret > cnt) {
				cnt = ret; res = r1;
			}
			
		}
		
		for(int i = 0; i < n; i++) {
			out.print(res[i] + " ");
		}
		out.println();
		
		out.close();
	}
	
	class FastScanner {
		public int BS = 1<<16;
		public char NC = (char)0;
		byte[] buf = new byte[BS];
		int bId = 0, size = 0;
		char c = NC;
		double num = 1;
		BufferedInputStream in;

		public FastScanner() {
			in = new BufferedInputStream(System.in, BS);
		}

		public FastScanner(String s) throws FileNotFoundException {
			in = new BufferedInputStream(new FileInputStream(new File(s)), BS);
		}

		public char nextChar(){
			while(bId==size) {
				try {
					size = in.read(buf);
				}catch(Exception e) {
					return NC;
				}                
				if(size==-1)return NC;
				bId=0;
			}
			return (char)buf[bId++];
		}

		public int nextInt() {
			return (int)nextLong();
		}

		public long nextLong() {
			num=1;
			boolean neg = false;
			if(c==NC)c=nextChar();
			for(;(c<'0' || c>'9'); c = nextChar()) {
				if(c=='-')neg=true;
			}
			long res = 0;
			for(; c>='0' && c <='9'; c=nextChar()) {
				res = (res<<3)+(res<<1)+c-'0';
				num*=10;
			}
			return neg?-res:res;
		}

		public double nextDouble() {
			double cur = nextLong();
			return c!='.' ? cur:cur+nextLong()/num;
		}

		public String next() {
			StringBuilder res = new StringBuilder();
			while(c<=32)c=nextChar();
			while(c>32) {
				res.append(c);
				c=nextChar();
			}
			return res.toString();
		}

		public String nextLine() {
			StringBuilder res = new StringBuilder();
			while(c<=32)c=nextChar();
			while(c!='\n') {
				res.append(c);
				c=nextChar();
			}
			return res.toString();
		}

		public boolean hasNext() {
			if(c>32)return true;
			while(true) {
				c=nextChar();
				if(c==NC)return false;
				else if(c>32)return true;
			}
		}
		
		public int[] nextIntArray(int n) {
			int[] res = new int[n];
			for(int i = 0; i < n; i++) res[i] = nextInt();
			return res;
		}
		
	}

	
}