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.util.*;
import java.io.*;
import java.math.*;
import java.util.BitSet;
public class population
{


     static int MAXN=5*1000001; static int arr[]=new int[MAXN];
    static int spf[] = new int[MAXN]; 
   
    static int power(int x, int y) 
    { 
     
    int res = 1;  
 
    while (y > 0)  
    { 
       
        if ((y & 1) == 1) 
            res = ((res) * (x))%(1000000000+7); 
  
        
        y = y >> 1;
        x = ((x)) *((x))%(1000000000+7);
    } 
    return res%(1000000000+7); 
    } 


    static void sieveOfEratosthenes(boolean prime[],int n) 
    { 
        for(int i=0;i<n;i++) 
            prime[i] = true; 
          
        for(int p = 2; p*p <=n; p++) 
        { 
            
            if(prime[p] == true) 
            { 
        
                for(int i = p*p; i <= n; i += p) 
                    prime[i] = false; 
            } 
        } 
    }
    
     
    static int gcd(int a, int b) 
    { 
      if (b == 0) 
        return a; 
      return gcd(b, a % b);  
    } 


     private static void union(int[] parent,int src,int dest)
    {
        int a = find(parent,src);
        int b = find(parent,dest);
        if(a!=b)
        parent[a]=b;
        return;
    }
    private static int find(int[] parent, int source) 
    {
        if(parent[source]==-1)
        return source;
        return find(parent,parent[source]);
    }
    
 
  
  
    public static void main(String ag[])
    {
       FastReader sc=new FastReader();
        /*ArrayList<Integer> al=new ArrayList<Integer>();*/ 
        /*String s=sc.nextLine();*/
        //hm.containsKey(); hm.get(k); hm.put(k,v); HashMap<Integer,Integer> hm=new HashMap<>();
        /*String[] arrOfStr = s.split(" "); */
        /*boolean visited[]=new boolean[arrOfStr.length];*/
        /* System.out.printf("%.6f\n",dp[R][G]); */
    int i,j;
    boolean prime[]=new boolean[400000+1];
    for( i=0;i<prime.length;i++) 
            prime[i] = true; 
          
        for(int p = 2; p*p <prime.length; p++) 
        { 
            
            if(prime[p] == true) 
            { 
        
                for(i = p*p; i < prime.length; i += p) 
                    prime[i] = false; 
            } 
        } 
   int n=sc.nextInt();
   int arr[]=new int[n];
   int c1=0;
   int c2=0;
   for(i=0;i<n;i++)
   {
      int y=sc.nextInt();
      if(y==1)
      c1++;
      else
      c2++; 
   }
   int sum=0;
   StringBuffer sb=new StringBuffer();
   for(i=0;i<n;i++)
   {
       if(c2>0&&prime[(sum+2)]==true)
       {
           c2--;
           sum=sum+2;
           sb.append(2+" ");
       }
       else if(c1>0&&prime[(sum+1)]==true)
       {
           c1--;
           sum=sum+1;
           sb.append(1+" ");
       }
       else if(c2>0)
       {
           c2--;
           sum=sum+2;
           sb.append(2+" ");
       }
       else
       {
           c1--;
           sum=sum+1;
           sb.append(1+" ");
       }
   }
System.out.println(sb);
    
    

     
 } 
   
   public static void sieves() 
    { 
        spf[1] = 1; 
        for (int i=2; i<MAXN; i++) 
            spf[i] = i; 
        for (int i=4; i<MAXN; i+=2) 
            spf[i] = 2; 
        for (long i=3; i*i<MAXN; i++) 
        { 
            if (spf[(int)i] == i) 
            { 
                for (long j=i*i; j<MAXN; j+=i) 
                    if (spf[(int)j]==j) 
                        spf[(int)j] = (int)i; 
            } 
        } 
    } 
    static void getFactorizations(int x) 
    { 
        int num=x;
        while (x != 1) 
        { 
            arr[num]++;
            x = x / spf[x]; 
        }
    } 
}

class Edge
{
    int v,w;
    Edge(int v,int w)
    {
        this.v=v;
        this.w=w;
    }
}

class Graph
{
    int V;
    int E;
    boolean visited[];
    ArrayList<Edge> adjLists[];
   
    Graph(int V,int E)
    {
        this.V=V;
        this.E=E;
        visited=new boolean[V+1];
        adjLists=new ArrayList[V+1];
       
        for (int i = 0; i <=V; i++)
        {
            adjLists[i]=new ArrayList<Edge>();
        }
        
    }
 

    public void addEdge(int s,int d)
    {
        
        Edge e=new Edge(d,0);
        adjLists[s].add(e);
        Edge e1=new Edge(s,0);
        adjLists[d].add(e1);
       
    }


    public int DFS(int v) 
    { 
    visited[v]=true;  
    int y=0;  
    Iterator<Edge> i = adjLists[v].listIterator(); 
    if(!i.hasNext())
    return 0;
    while (i.hasNext()) 
    { 
        Edge e=i.next();
        int n = e.v; 
       
       if(!visited[n])
       {
         y= Math.max(1+DFS(n),y);

       }

     }
     return y; 

    }
    
    public boolean isEulerCircuit()
    {
       for(int i=1;i<=V;i++)
       {
           if(adjLists[i].size()%2!=0)
           return false;
       } 
       return true;
    }
    public void BFS()
    {
        Queue<Edge> q=new LinkedList<>();
        int price[]=new int[V+1];
        Arrays.fill(price,Integer.MAX_VALUE);
        q.add(new Edge(1,0));
        price[1]=0;
        while(!q.isEmpty())
        {
            Edge e=q.poll();
            int cost=e.w;
            if(e.v!=V)
            {
             for(Edge s:adjLists[e.v])
            {
            if(cost+s.w<price[s.v])
            {
                price[s.v]=cost+s.w;
                q.add(new Edge(s.v,cost+s.w));
            }    
            }   
            }
            
        }
        if(price[V]==Integer.MAX_VALUE)
        System.out.println(-1);
        else
        System.out.println(price[V]);
    } 
  
}


class Tcomp implements Comparator<Node>
{
    @Override
    public int compare(Node e1, Node e2) {
        if(e1.e<e2.e)
        {
        return 1;
        }
        else if(e1.e>e2.e)
        {
            return -1;
        }
        if(e1.d<e2.d)
        {
            return 1;
        }
        else if(e1.d>e2.d)
        {
            return -1;
        }

       if(e1.b<e2.b)
        {
            return 1;
        }
        else if(e1.b>e2.b)
        {
            return -1;
        }

        if(e1.a<e2.a)
        {
            return 1;
        }
       else
       {
           return -1;
       }
    }
    
}


class Node
{
    int a;
    int b;
    int c;
    int d;
    int e;
    Node(int a,int b,int c,int d,int e)
    {
        this.a=a;
        this.b=b;
        this.c=c;
        this.d=d;
        this.e=e;
       
        
    }
}


class FastReader {

    BufferedReader bf;
    StringTokenizer st;

    public FastReader() {
        bf = new BufferedReader(new InputStreamReader(System.in));
    }

    String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(bf.readLine());
            } catch (Exception e) {
                System.out.println(e);
            }
        }
        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 = bf.readLine();
        } catch (Exception e) {
            System.out.println(e);
        }
        return str;
    }
}






