Problem: This is the easy version of the problem. The difference between the versions is that in the easy version all prices a_i are different. You can make hacks if and only if you solved both versions of the problem.

Today is Sage's birthday, and she will go shopping to buy ice spheres. All n ice spheres are placed in a row and they are numbered from 1 to n from left to right. Each ice sphere has a positive integer price. In this version all prices are different.

An ice sphere is cheap if it costs strictly less than two neighboring ice spheres: the nearest to the left and the nearest to the right. The leftmost and the rightmost ice spheres are not cheap. Sage will choose all cheap ice spheres and then buy only them.

You can visit the shop before Sage and reorder the ice spheres as you wish. Find out the maximum number of ice spheres that Sage can buy, and show how the ice spheres should be reordered.

Input

The first line contains a single integer n (1 ≤ n ≤ 10^5) — the number of ice spheres in the shop.

The second line contains n different integers a_1, a_2, ..., a_n (1 ≤ a_i ≤ 10^9) — the prices of ice spheres.

Output

In the first line print the maximum number of ice spheres that Sage can buy.

In the second line print the prices of ice spheres in the optimal order. If there are several correct answers, you can print any of them.

Example

Input


5
1 2 3 4 5


Output


2
3 1 4 2 5 

Note

In the example it's not possible to place ice spheres in any order so that Sage would buy 3 of them. If the ice spheres are placed like this (3, 1, 4, 2, 5), then Sage will buy two spheres: one for 1 and one for 2, because they are cheap.

Solution (in JAVA):

Solution:
    import java.io.*;
import java.text.DecimalFormat;
import java.util.*;
    public class main2 {
    	static ArrayList<pair> factors;
    	static boolean isComposite[];
    	static ArrayList<Integer> primes;
    	public static boolean isprime(long n){
    		if(n<=10001){
    			return !isComposite[(int)n];
    		}
    		for(int i=0;i<primes.size();i++){
    			if(primes.get(i)*primes.get(i)*1l>n){
    				break;
    			}
    			if(n%primes.get(i)==0){
    				return false;
    			}
    			
    		}
    		return true;
    	}
    	static int[] res;
    	
    	public static void sieve(int n){
    		isComposite=new boolean[n+1];
    		primes =new ArrayList<Integer>();
    		isComposite[0]=true;
    		isComposite[1]=true;
    		for(int i=2;i<=n;i++){
    			if(!isComposite[i]){
    				for(int j=2*i;j<=n;j=j+i){
    					isComposite[j]=true;
    				}
    			}
    			primes.add(i);
    		}
    		
    	}
    	public static void primefactors(long n){
    		 factors=new ArrayList<pair>();
    		for(int x:primes){
    			if(x*x*1l>n){
    				break;
    			}
    		
    			
    			if(n%x==0){
    				
    					pair p=new pair(x,0);
    					 factors.add(p);
    				while(n%x==0){
    				n/=x;
    				p.y++;}
    				
    			}
    		}
    		if(n!=1){
    			factors.add(new pair((int)n,1));
    		}
    		
    	}
    	public static long powfact(long n,long p){
    		int res=0;
    		for(long i=p;i*1l<=n;i=i*p*1l){
    			res+=(n/i);
    		}
    		return res;
    	}
    	
    	public static long GCD(long i, long j){
    	if (i==0){
    		return j;
    	}
    	return GCD(j%i,i);
    	}
    	public static long LCM(long i, long j){
    		return(i*j)/GCD(i,j);
    	}
     
     
    	public static void main(String[] args) throws Exception {
    	Scanner sc=new Scanner(System.in);
    int n=sc.nextInt();
    long [] a=new long[n];
    for(int i=0;i<n;i++){
    	a[i]=sc.nextLong();
    }
    int x=0;
    Arrays.sort(a);
    long []ans=new long[n];
   if(n%2==1){
	   System.out.println(n/2);
	   x=n/2;
	
	   for(int i=0,j=x,k=0;i<x;i++,j++,k+=2){
		   ans[k]=a[j];
		   ans[k+1]=a[i];
	   }
	   ans[n-1]=a[n-1];
   }
   else{
	   System.out.println(n/2-1);
	   
	   x=(n-1)/2;
	   ans[0]=a[n-1];
	   for(int i=0,j=x,k=1;i<x;i++,j++,k+=2){
		   ans[k]=a[j];
		   ans[k+1]=a[i];
	   }
	   ans[n-1]=a[n-2];
   }
   
    for(int i=0;i<n;i++){
    	System.out.print(ans[i]+" ");
    	
    }
    System.out.println();

    }
     static long[] fact;
     public static long fact(int x){
long y=(int)Math.pow(2,x)-1;
return((y+1)*(y/2)+(y/2+1));
}     
    	
    	static int n;
    	static ArrayList<Integer > [] adjlist;
    	static int [] leaves;
    	static PriorityQueue<pair> centroid;
    	
    	public static void dfs1(int u,int p){
    		leaves[u]=1;
    		if(adjlist[u].size()==1&&u!=0){
    			
    			return;
    		}
    		for( int x:adjlist[u]){
    			if(x!=p){
    				dfs1(x,u);
    				leaves[u]+=leaves[x];
    			}
    		}
    	}
    	public static void dfs(int u,int p){
    		if(adjlist[u].size()==1&&u!=0){
    			centroid.add(new pair(n-1,u));
    			return;
    		}
    		int ans=n-leaves[u];
    		for(int x:adjlist[u]){
    			if(x!=p){
    			ans=Math.max(ans, leaves[x]);
    			dfs(x,u);
    			
    			}
    		}
    		centroid.add(new pair(ans,u));
    		}
    	
    	static class pair implements Comparable<pair>{
    		int x;
    		int y;
    		public pair(int x, int y){
    			this.x=x;
    					this.y=y;
    		}
			@Override
			public int compareTo(pair o) {
				// TODO Auto-generated method stub
				return x-o.x;
			}
    	}
    	
    	  	 	static class SegmentTree{
    	   	 		int[] arr , sTree;
    	   	 	static	int N;
    	   	 		public SegmentTree(int[] in){
    	   	 			arr=in;
    	   	 		N=arr.length-1;
    	   	 			sTree=new int[2*N];
    	   	 			
    	   	 			build(1,1,N);
    	   	 		}
    	   	 		public void build(int node, int l, int r){
    	   	 			if(l==r){
    	   	 				sTree[node]=arr[l];
    	   	 			}
    	   	 			else{
    	   	 				int leftchild=node*2;
    	   	 				int rightchild=node*2+1;
    	   	 				int mid =(l+r)/2;
    	   	 				build(leftchild,l,mid);
    	   	 				build(rightchild,mid+1,r);
    	   	 				sTree[node]=sTree[leftchild]&sTree[rightchild];
    	   	 			}
    	   	 		}
    	   	 		public  void update(int i, int val){
    	   	 			int node =i+N-1;
    	   	 			arr[i]=val;
    	   	 			sTree[node]=val;
    	   	 			node=node/2;
    	   	 			while(node>0){
    	   	 			int leftchild=node *2;
       	 				int rightchild=node*2+1;
       	 			sTree[node]=sTree[leftchild]&sTree[rightchild];
       	 			node=node/2;
    	   	 			}
    	   	 			return;
    	   	 			
    	   	 		}
    	   	 		public int query(int i, int j){
    	   	 			 return query(1,1, N,  i, j);
    	   	 		}
    	   	 		public int query(int node,int l, int r, int i , int j){
    	   	 			if(i>r||j<l){
    	   	 				return 1<<30;
    	   	 			}
    	   	 			if(i<=l&&r<=j){
    	   	 				return sTree[node];
    	   	 			}
    	   	 		int leftchild=node*2;
    	 				int rightchild=node*2+1;
    	 				int mid =(l+r)/2;
    	 				
    	 			return	query(leftchild,l,mid,i,j)&query(rightchild,mid+1,r,i,j);
    	 				
    	   	 		}
    	   	 	}
     
     
    	static class Scanner {
    		StringTokenizer st;
    		BufferedReader br;
     
    		public Scanner(InputStream s) {
    			br = new BufferedReader(new InputStreamReader(s));
    		}
     
    		public boolean hasNext() {
    			// TODO Auto-generated method stub
    			return false;
    		}
     
    		public String next() throws IOException {
    			while (st == null || !st.hasMoreTokens())
    				st = new StringTokenizer(br.readLine());
    			return st.nextToken();
    		}
     
    		public int nextInt() throws IOException {
    			return Integer.parseInt(next());
    		}
     
    		public long nextLong() throws IOException {
    			return Long.parseLong(next());
    		}
     
    		public String nextLine() throws IOException {
    			return br.readLine();
    		}
     
    		public double nextDouble() throws IOException {
    			String x = next();
    			StringBuilder sb = new StringBuilder("0");
    			double res = 0, f = 1;
    			boolean dec = false, neg = false;
    			int start = 0;
    			if (x.charAt(0) == '-') {
    				neg = true;
    				start++;
    			}
    			for (int i = start; i < x.length(); i++)
    				if (x.charAt(i) == '.') {
    					res = Long.parseLong(sb.toString());
    					sb = new StringBuilder("0");
    					dec = true;
    				} else {
    					sb.append(x.charAt(i));
    					if (dec)
    						f *= 10;
    				}
    			res += Long.parseLong(sb.toString()) / f;
    			return res * (neg ? -1 : 1);
    		}
     
    		public boolean ready() throws IOException {
    			return br.ready();
    		}
     
    	}}