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 PYTHON3):

Solution:
from math import ceil, log, floor, sqrt
import math	
	
	
k = 1	
def mod_expo(n, p, m):
	"""find (n^p)%m"""
	result = 1
	while p != 0:
		if p%2 == 1:
			result = (result * n)%m
		p //= 2
		n = (n * n)%m
	return result
	
def min_subs(n, binary):
	a, b = 1, 1
	mx = 0
	prev = not int(binary[0])
	res = [0] * n
	for i in range(n):
		if int(binary[i]) == 1:
			#b = 1
			if int(binary[i]) == prev:
				a += 1
				b = a
			res[i] = a
		else:
			#a = 1
			if int(binary[i]) == prev:
				b += 1
				a = b
			res[i] = b	
			
			
		prev = int(binary[i])
		
		mx = max(mx, max(a, b))
	print(mx)
	print(*res, sep=' ')
	#return 1 + (n-   las)

def steps(n):
	return n//2 + 1
	
	
def find_winner(n):
	if n%2:
		print("black")
	else:
		print("white")
		print("1 2")
	
def dp_dy(x, y):
	return (125*pow(x,2) - pow(x,3) - 2*pow(x,2)*y - 5000*x + 150*x*y - x*pow(y,2) + 25*pow(y,2))/(pow(x+y, 2)*pow(100-x-y, 2))	
	
def all_neg():
	for x in range(0, 51):
		for y in range(0, 51):
			if x + y != 100 and x+y != 0:
				print(dp_dy(x, y), x, y)
				if dp_dy(x, y) > 0:
					return False
				
	return True
def can_palindrome(r, g, b, w):
	no = 0
	mn = pow(10, 9) + 1
	mn = min(mn, r)
	mn = min(mn, g)
	mn = min(mn, b)
	if r%2 == 1:
		no += 1
	if g%2 == 1:
		no += 1
	if b%2 == 1:
		no += 1
	if w%2 == 1:
		no += 1
	if no <= 1:
		return True
	if no == 3 and mn > 0:
		return True
	return False
def max_find(n, k, z, a):
	res = 0
	s = 0
	mx = 0
	for t in range(z+1):
		pos = k -2*t
		if pos < 0:
			continue
		mx = 0
		s = 0
		for i in range(pos + 1):
			if i < n-1:
				mx = max(mx, a[i] + a[i+1])
			s += a[i]
		res = max(res, s + mx*t)
	return res
	
def stair_count(n):
	return n*(n+1)//2
	
def count_total(n):
	count = 0
	start = 1
	while (n >= stair_count(start)):
		cells = stair_count(start)
		n -= cells
		count += 1
		start = 2*start + 1
	return count

def get_cnt(n, arr):
	j = 0
	arr.sort()
	b = []
	for i in range(n):
		b.append(-1) 
	for i in range(n-1):
		if i%2 == 1:
			b[i] = arr[j]
			j += 1
	for i in range(n):
		if b[i] == -1:
			b[i] = arr[j]
			j += 1
	if n%2 == 0:
		n -= 1
	print(n//2)
	print(*b, sep=' ')
	
t = 1
#t = int(input())
while t:
	t = t - 1
	n = int(input())
	#print(count_total(n))
	#r, g, b, w = map(int, input().split())
	#a = input()
	arr = list(map(int, input().split()))
	#mx = max(arr)
	#res = ['a' * (mx + 1)] * (n+1)
	#for i, x in enumerate(arr):
	#	who = 'a' if res[i][x] == 'b' else 'b'
	#	res[i+1] = res[i][:x] + who + res[i][x + 1:]
	#a = list(map(int, input().strip().split()))[:n]
	#if can_palindrome(r, g, b, w):
	#	print("YES")
	#else:
	#	print("NO")
	#n = int(n)
	#for i, x in enumerate(arr):
    #        who = 'a' if res[i][x] == 'b' else 'b'
    #        res[i + 1] = res[i][:x] + who + res[i][x + 1:]
	#print('\n'.join(res))
	#print(all_neg())
	get_cnt(n, arr)