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.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.StringTokenizer; 
					  
					
					public class temp4 {
						static class FastReader 
					    { 
					        BufferedReader br; 
					        StringTokenizer st; 
					  
					        public FastReader() 
					        { 
					            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; 
					        } 
					    } 
						
					/*	static class Reader 
					    { 
					        final private int BUFFER_SIZE = 1 << 16; 
					        private DataInputStream din; 
					        private byte[] buffer; 
					        private int bufferPointer, bytesRead; 
					  
					        public Reader() 
					        { 
					            din = new DataInputStream(System.in); 
					            buffer = new byte[BUFFER_SIZE]; 
					            bufferPointer = bytesRead = 0; 
					        } 
					  
					        public Reader(String file_name) throws IOException 
					        { 
					            din = new DataInputStream(new FileInputStream(file_name)); 
					            buffer = new byte[BUFFER_SIZE]; 
					            bufferPointer = bytesRead = 0; 
					        } 
					  
					        public String readLine() throws IOException 
					        { 
					            byte[] buf = new byte[64]; // line length 
					            int cnt = 0, c; 
					            while ((c = read()) != -1) 
					            { 
					                if (c == '\n') 
					                    break; 
					                buf[cnt++] = (byte) c; 
					            } 
					            return new String(buf, 0, cnt); 
					        } 
					  
					        public int nextInt() throws IOException 
					        { 
					            int ret = 0; 
					            byte c = read(); 
					            while (c <= ' ') 
					                c = read(); 
					            boolean neg = (c == '-'); 
					            if (neg) 
					                c = read(); 
					            do
					            { 
					                ret = ret * 10 + c - '0'; 
					            }  while ((c = read()) >= '0' && c <= '9'); 
					  
					            if (neg) 
					                return -ret; 
					            return ret; 
					        } 
					  
					        public long nextLong() throws IOException 
					        { 
					            long ret = 0; 
					            byte c = read(); 
					            while (c <= ' ') 
					                c = read(); 
					            boolean neg = (c == '-'); 
					            if (neg) 
					                c = read(); 
					            do { 
					                ret = ret * 10 + c - '0'; 
					            } 
					            while ((c = read()) >= '0' && c <= '9'); 
					            if (neg) 
					                return -ret; 
					            return ret; 
					        } 
					  
					        public double nextDouble() throws IOException 
					        { 
					            double ret = 0, div = 1; 
					            byte c = read(); 
					            while (c <= ' ') 
					                c = read(); 
					            boolean neg = (c == '-'); 
					            if (neg) 
					                c = read(); 
					  
					            do { 
					                ret = ret * 10 + c - '0'; 
					            } 
					            while ((c = read()) >= '0' && c <= '9'); 
					  
					            if (c == '.') 
					            { 
					                while ((c = read()) >= '0' && c <= '9') 
					                { 
					                    ret += (c - '0') / (div *= 10); 
					                } 
					            } 
					  
					            if (neg) 
					                return -ret; 
					            return ret; 
					        } 
					  
					        private void fillBuffer() throws IOException 
					        { 
					            bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE); 
					            if (bytesRead == -1) 
					                buffer[0] = -1; 
					        } 
					  
					        private byte read() throws IOException 
					        { 
					            if (bufferPointer == bytesRead) 
					                fillBuffer(); 
					            return buffer[bufferPointer++]; 
					        } 
					  
					        public void close() throws IOException 
					        { 
					            if (din == null) 
					                return; 
					            din.close(); 
					        } 
					    } */
						static class Print
					{
						    private final BufferedWriter bw;
						    public Print()
						    {
						        bw=new BufferedWriter(new OutputStreamWriter(System.out));
						    }
					    public void print(String str)throws IOException
						    {
						        bw.append(str);
						    }
						    public void println(String str)throws IOException
						    {
						        print(str);
						        bw.append("\n");
						    }
						    public void close()throws IOException
						    {
						        bw.close();
						    }} 
							
							
							
							public static void main(String[] args) throws IOException {			
								FastReader scn=new FastReader();
								Print pr=new Print();
								int n=scn.nextInt(),x=0,one=0,two=0;
								for(int i=0;i<n;i++){
									x=scn.nextInt();
									if(x==1)one++;
									else two++;
								}
								if(one>=3){
									pr.print("1 1 1 ");one-=3;
								}
								else if(one>0&&two>0){
									pr.print("2 1 ");one--;two--;
								}
								
								for(int i=0;i<two;i++){
									pr.print("2 ");
								}
								for(int i=0;i<one;i++){
									pr.print("1 ");
								}
								pr.close();
								
							}
							
						
						
								public static class node{
								int a;
								int b;
								public node(int a,int b){
									this.a=a;this.b=b;
								}
							}
							
					}
						