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.
//JAI BAJRANGBALI                                                                                                                                               
import java.util.*;
import java.io.*;
import java.math.BigInteger;
//class Main    //AtCoder
//class Solution // Codechef
public class Solution //Codeforces
{    
    public final static int d = 256; 
    static int MOD = 1000000007;
    static final float EPSILON = (float)0.01; 
    static final double PI = Math.PI;
    private static BufferedReader in = new BufferedReader (new InputStreamReader (System.in));
    private static BufferedWriter out = new BufferedWriter (new OutputStreamWriter (System.out));
    static class Graph {         
        int V; 
        LinkedList<Integer>[] adjListArray; 
         Graph(int V) { 
            this.V = V; 
            adjListArray = new LinkedList[V]; 
            for(int i = 0; i < V ; i++){ 
                adjListArray[i] = new LinkedList<Integer>(); 
            } 
        }
        void addEdge( int src, int dest) {             
            adjListArray[src].add(dest); 
            adjListArray[dest].add(src); 
        } 
          
        void DFSUtil(int v, boolean[] visited) {             
            visited[v] = true; 
            for (int x : adjListArray[v]) { 
                if(!visited[x]) DFSUtil(x,visited); 
            } 
      
        } 
        int connectedComponents() {             
            boolean[] visited = new boolean[V]; 
            int cnt = 0;
            for(int v = 0; v < V; ++v) { 
                if(!visited[v] && adjListArray[v].size() != 0) { 
                    DFSUtil(v,visited); 
                    cnt++;                     
                } 
            }
            return cnt; 
        }
    } 
    static class SegmentTree{
        int arr[] , st[];
        int maxSize , N;
        SegmentTree(int arr[] , int N){
            this.arr = arr;
            this.N = N;
            int x = (int) (Math.ceil(Math.log(N) / Math.log(2))); 
            this.maxSize = 2 * (int) Math.pow(2, x) - 1;
            this.st = new int[maxSize];
            constructST(0 , N-1 , 0);
        }
        void constructST(int start , int end , int ind)
        {
            constructSTUtil(start , end , ind);
        }
        int constructSTUtil(int start , int end , int ind)
        {            
            
            if(start == end){
                st[ind] = arr[start];
                return st[ind];
            }
            else{
                int mid = start + (end - start)/2;
                st[ind] = constructSTUtil(start , mid , (2*ind) + 1) ^ constructSTUtil(mid+1 , end , (2*ind) + 2);
                return st[ind]; 
            }            
        }
        int findXorInRange(int start , int end , int qstart , int qend , int index)
        {
            if(qstart <= start && qend >= end)
            {
                return st[index];
            }
            else if(qstart > end || qend < start || end < start){
                return 0;
            }
            else{
                int mid = start + (end - start)/2;
                return findXorInRange(start , mid , qstart , qend , (2*index) + 1) ^ findXorInRange(mid+1 , end , qstart , qend , (2*index) + 2);
            }
        }    
    }      

    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 Cell{
        int X , Y , dis;
        Cell(int x , int y , int di){
            X = x;
            Y = y;
            dis = di;
        }
    }
    static boolean isValid(int x , int y , int N , int M){
        return ((x >= 0 && x < N) &&(y >= 0 && y < M));
    }            
    static int searchRabinKarp(String pat, String txt) 
    { 
        int M = pat.length(); 
        int N = txt.length(); 
        int i, j; 
        int p = 0; // hash value for pattern 
        int t = 0; // hash value for txt 
        int h = 1 , cnt = 0; 
        int q = 3355439;         
        for (i = 0; i < M-1; i++) 
            h = (h*d)%q; 
        for (i = 0; i < M; i++) 
        { 
            p = (d*p + pat.charAt(i))%q; 
            t = (d*t + txt.charAt(i))%q; 
        } 
        for (i = 0; i <= N - M; i++) 
        {     
            if ( p == t ) 
            {                 
                for (j = 0; j < M; j++) 
                { 
                    if (txt.charAt(i+j) != pat.charAt(j)) 
                        break; 
                }                 
                if (j == M) 
                {//System.out.println("Pattern found at index " + i);
                    cnt++;
                } 
            } 
            if ( i < N-M ) 
            { 
                t = (d*(t - txt.charAt(i)*h) + txt.charAt(i+M))%q; 
                if (t < 0) 
                    t = (t + q); 
            } 
        } 
        return cnt;
    }
    static long gcd(long bigger , long smaller)
    {
            if (smaller == 0) 
                return bigger; 
            return gcd(smaller, bigger % smaller); 
    }
    static long lcm(long a, long b) 
    { 
        return (a*b)/gcd(a, b); 
    } 
    static long sumOfArray(long arr[])
    {
        long sum = 0;
        for(int i = 0 ; i < arr.length ; i++)
            sum += arr[i];
        return sum;
    }
    static boolean isPrime(long n) {
        if(n == 2)
            return true;
        else if(n == 1)
            return false;
        else if (n%2==0)
            return false;          
        for(long i=3;i<=Math.sqrt(n);i+=2) { 
            if(n%i==0) 
                return false; 
        } 
        return true; 
    }
    static long modularExpo(long x, long y, long p) 
    {              
       long res = 1;      
       x = x % p;
       if (x == 0) return 0;
        while (y > 0) 
        { 
            if((y & 1)==1) 
                res = (res * x) % p; 
            y = y >> 1;  
            x = (x * x) % p;  
        } 
        return res; 
    }
    static long countDigit(long n) 
    { 
        return (long)Math.floor(Math.log10(n) + 1); 
    }
    static long sumOfDigits(long n) 
    { 
        long sum;        
        for (sum = 0; n > 0; sum += n % 10,n /= 10);   
        return sum; 
    }        
    static boolean isPalindrome(String str) 
    {   
        int i = 0, j = str.length() - 1; 
        while (i < j) { 
            if (str.charAt(i) != str.charAt(j)) 
                return false; 
            i++; 
            j--; 
        } 
        return true; 
    }      
    public static void main(String args[])
    {
        try{
            FastReader sc = new FastReader();
            int T = 1;//sc.nextInt();
            while(T-- > 0)
            {   
                int N = sc.nextInt();
                int arr[] = new int[N];
                for(int i = 0 ; i < N ; i++)
                    arr[i] = sc.nextInt();
                Arrays.sort(arr);
                int cnt = ((N & 1) == 0)?((N/2)-1):(N/2);
                int ar[] = new int[N];
                int fi = (N/2);//((N%2) == 0) ? (N/2) : ((N/2)+1);
                int cnt2=0;
                for(int i = fi ; i < arr.length ; i++)
                {
                    ar[cnt2] = arr[i];
                    cnt2+=2;
                }
                cnt2=1;
                for(int i = 0 ; i < ((N/2)) ; i++)
                {
                    ar[cnt2] =arr[i];
                    cnt2+=2;
                }
                System.out.println(cnt);
                for(int i = 0 ; i < ar.length ; i++){
                    System.out.print(ar[i]+" ");
                }
                System.out.println();
            }        
            try{
                out.flush();
            }catch(Exception e){
                System.out.print(e);
            };
        }
        catch(Exception e){
            System.out.print(e);
        }
    } 
    public static void solve(int arr[] , int N)
    { 
        try{    
            int min=Integer.MAX_VALUE; 
            int f = 1,me =0 , cnt = 0 , prev0  = 0 , prev1 = 0;
            boolean fresh = false;
            if(N == 1)
            {
                System.out.println("1");
            } 
            else{
                if(arr[0] == 0)
                {
                    prev0 = 1;                    
                }
                else
                    prev1 = 1;
                for(int i = 1;i<N;i++)
                {
                    if(f == 1){
                        if(fresh)
                        {
                            if(arr[i]==1){
                                prev1=1;
                                fresh=false;                                
                            }
                            else{
                                prev1=0; 
                                fresh=false;                               
                            }
                        }
                        else{
                            
                        }
                    }
                }
            }
        }catch(Exception e){
            System.out.println(e);
        }
    }    
}