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.
/*
 * Remember a 6.0 student can know more than a 10.0 student.
 * Grades don't determine intelligence, they test obedience. 
 * I Never Give Up.
 * I will become Candidate Master.
 * I will defeat Saurabh Anand.
 * Skills are Cheap,Passion is Priceless.
 */
import java.util.*;
import java.util.Map.Entry;
import java.io.*;

import static java.lang.System.out;
import static java.util.Arrays.*;
import static java.lang.Math.*;
public class ContestMain {
	private static Reader in=new Reader();
	private static StringBuilder ans=new StringBuilder();
	private static long MOD=1000000000+7;//10^9+7
	private static final int N=100000+7; //10^5+7
//	private static final double EPS=1e-9;
//	private static final int LIM=26;
//	private static final double PI=3.1415;
	private static ArrayList<Integer> v[]=new ArrayList[N];
//	private static int color[]=new int[N];
	private static boolean mark[]=new boolean[N];
//	private static BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
//	private static ArrayList<Pair> v[]=new ArrayList[N];
	private static long powmod(long x,long n){
		if(n==0||x==0)return 1;
		else if(n%2==0)return(powmod((x*x)%MOD,n/2));
		else return (x*(powmod((x*x)%MOD,(n-1)/2)))%MOD;
	}
	private static void shuffle(long [] arr) {
		for (int i = arr.length - 1; i >= 2; i--) {
			int x = new Random().nextInt(i - 1);
	        long temp = arr[x];
	        arr[x] = arr[i];
	        arr[i] = temp;
	    }
	 }
//	private static long gcd(long a, long b){
//		if(b==0)return a;
//		return gcd(b,a%b);
//	}
//	private static boolean check(int x,int y){
//		if((x>=0&&x<n)&&(y>=0&&y<m)&&mat[x][y]!='X'&&!visited[x][y])return true;
//		return false;
//	}
//	static class Node{
//		int left;
//		int right;
//		Node(){
//			left=0;
//			right=0;
//		}
//	}
	public static boolean isPrime(int num){
		for(int i=2;i<=sqrt(num);i++){
			if(num%i==0)return false;
		}
		return true;
	}
	public static void main(String[] args) throws IOException{
		int n=in.nextInt();
		int ar[]=new int[n];
		int one_cnt=0,two_cnt=0;
		for(int i=0;i<n;i++){
			ar[i]=in.nextInt();
			if(ar[i]==1)one_cnt++;
			else two_cnt++;
		}
		int res1[]=new int[n];
		int res2[]=new int[n];
		int sum1=1,sum2=2,cnt1=0,cnt2=0;
		if(one_cnt>0){
			res1[0]=1;
			one_cnt--;
			for(int i=1;i<n;i++){
				if(sum1%2==0){
					if(one_cnt>0){res1[i]=1;one_cnt--;sum1++;}
					else {res1[i]=2;two_cnt--;sum1+=2;}
				}
				else{
					if(two_cnt>0){res1[i]=2;two_cnt--;sum1+=2;}
					else {res1[i]=1;one_cnt--;sum1++;}
				}
				if(isPrime(sum1))cnt1++;
			}
		}
		one_cnt=0;two_cnt=0;
		for(int i=0;i<n;i++){
			if(ar[i]==1)one_cnt++;
			else two_cnt++;
		}
		if(two_cnt>0){
			res2[0]=2;
			cnt2=1;
			two_cnt--;
			for(int i=1;i<n;i++){
				if(sum2%2==0){
					if(one_cnt>0){res2[i]=1;one_cnt--;sum2+=1;}
					else {res2[i]=2;two_cnt--;sum2+=2;}
				}
				else{
					if(two_cnt>0){res2[i]=2;two_cnt--;sum2+=2;}
					else {res2[i]=1;one_cnt--;sum2+=1;}
				}
				if(isPrime(sum2))cnt2++;
			}
		}
		if(cnt1==cnt2){
			if(one_cnt>two_cnt){
				for(int i=0;i<n;i++)
					ans.append(res1[i]+" ");
			}
			else{
				for(int i=0;i<n;i++)
					ans.append(res2[i]+" ");
			}
		}
		else if(cnt1>cnt2){
			for(int i=0;i<n;i++)
				ans.append(res1[i]+" ");
		}
		else{
			for(int i=0;i<n;i++)
				ans.append(res2[i]+" ");
		}
		out.println(ans);
	}
	static class Pair<T> implements Comparable<Pair>{
		int l;
		int r;
		int ind;
		Pair(){
			l=0;
			r=0;
			ind=0;
		}
		Pair(int k,int v,int i){
			l=k;
			r=v;
			ind=i;
		}
//		@Override
//		public int compareTo(Pair o) {
//			if(o.l!=l)return (int) (l-o.l);
//			else return (int)(r-o.r);
//		}
		//Fenwick tree question comparator
		@Override
		public int compareTo(Pair o) {
			if(o.r!=r)return (int) (r-o.r);
			else return (int)(l-o.l);
		}
	}
	static class Reader{
        BufferedReader br;
        StringTokenizer st;
        public Reader()
        {
            br = new BufferedReader(new
                     InputStreamReader(System.in));
        }
 
        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
     
                	st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
 
        int nextInt()
        {
            return Integer.parseInt(next());
        }
 
        long nextLong()
        {
            return Long.parseLong(next());
        }
 
        double nextDouble()
        {
            return Double.parseDouble(next());
        }
 
        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }
}