An exam for n students will take place in a long and narrow room, so the students will sit in a line in some order. The teacher suspects that students with adjacent numbers (i and i + 1) always studied side by side and became friends and if they take an exam sitting next to each other, they will help each other for sure.

Your task is to choose the maximum number of students and make such an arrangement of students in the room that no two students with adjacent numbers sit side by side.


-----Input-----

A single line contains integer n (1 ≤ n ≤ 5000) — the number of students at an exam.


-----Output-----

In the first line print integer k — the maximum number of students who can be seated so that no two students with adjacent numbers sit next to each other.

In the second line print k distinct integers a_1, a_2, ..., a_{k} (1 ≤ a_{i} ≤ n), where a_{i} is the number of the student on the i-th position. The students on adjacent positions mustn't have adjacent numbers. Formally, the following should be true: |a_{i} - a_{i} + 1| ≠ 1 for all i from 1 to k - 1.

If there are several possible answers, output any of them.


-----Examples-----
Input
6
Output
6
1 5 3 6 2 4
Input
3

Output
2
1 3

Source: codeforces | Difficulty: EASY
Tags: Mathematics

Implementation

Constructive algorithms


Solutions:
n = int(input())
if n == 1 or n == 2:
	print(1)
	print(1)
elif n == 3:
	print(2)
	print(1, 3)
else:
	print(n)
	odd = [n for n in range(1, n + 1) if n % 2 != 0]
	even = [n for n in range(1, n + 1) if n % 2 == 0]
	print(*odd[::-1], *even[::-1])


n = int(input())
if n == 1:
	print(n)
	print(1)
elif n <= 3:
	print(n - 1)
	out = '1'
	for i in range(3, n + 1, 2):
		out += ' ' + str(i)
	print(out)
elif n == 4:
	print(4)
	print('3 1 4 2')
else:
	print(n)
	out = '1'
	for i in range(3, n + 1, 2):
		out += ' ' + str(i)
	for i in range(2, n + 1, 2):
		out += ' ' + str(i)
	print(out)


n = int(input())
even_arr = []
uneven_arr = []
i = 0
if n % 2 == 0:
	first_index = n // 2
	while i < first_index:
		uneven_arr.append(2 * i + 1)
		i += 1
	i = 0
	while i < first_index:
		i += 1
		even_arr.append(2 * i)
else:
	first_index = (n + 1) // 2
	second_index = (n + 1) // 2 - 1
	i = 0
	while i < first_index:
		uneven_arr.append(2 * i + 1)
		i += 1
	i = 0
	while i < second_index:
		i += 1
		even_arr.append(2 * i)
if n == 4:
	print(4)
	even_arr.extend(uneven_arr)
	print(' '.join([str(i) for i in even_arr]))
elif n == 3:
	print(2)
	print(' '.join([str(i) for i in uneven_arr]))
elif n == 2 or n == 1:
	print(1)
	print(' '.join([str(i) for i in uneven_arr]))
else:
	print(n)
	uneven_arr.extend(even_arr)
	print(' '.join([str(i) for i in uneven_arr]))


n = int(input())
if n == 1 or n == 2:
	print(1)
	print(1)
elif n == 3:
	print(2)
	print(1, 3)
else:
	print(n)
	for i in range(n - 1, 0, -2):
		print(i, end=' ')
	for i in range(n, 0, -2):
		print(i, end=' ')


def main():
	n = lie()
	if n <= 2:
		print('\n'.join(['1', '1']))
	elif n == 3:
		print(2)
		print(' '.join(['1', '3']))
	else:
		print(n)
		for i in range(2, n + 1, 2):
			print(i, end=' ')
		for i in range(1, n + 1, 2):
			print(i, end=' ')

def fun(m, n, s, k):
	return

def fun2(s):
	return
from sys import *
import inspect
import re
from math import *
import threading
from collections import *
from pprint import pprint as pp
mod = 998244353
MAX = 10 ** 5

def lie():
	return int(input())

def liee():
	return map(int, input().split())

def array():
	return list(map(int, input().split()))

def deb(p):
	for line in inspect.getframeinfo(inspect.currentframe().f_back)[3]:
		m = re.search('\\bdeb\\s*\\(\\s*([A-Za-z_][A-Za-z0-9_]*)\\s*\\)', line)
		print('%s %d' % (m.group(1), p))

def vector(size, val=0):
	vec = [val for i in range(size)]
	return vec

def matrix(rowNum, colNum, val=0):
	mat = []
	for i in range(rowNum):
		collumn = [val for j in range(colNum)]
		mat.append(collumn)
	return mat

def dmain():
	setrecursionlimit(100000000)
	threading.stack_size(40960000)
	thread = threading.Thread(target=main)
	thread.start()
dmain()


__author__ = 'artyom'
n = int(input())
a = [1] if n <= 2 else [1, 3] if n == 3 else [3, 1, 4, 2] if n == 4 else [i for i in range(1, n + 1, 2)] + [i for i in range(2, n + 1, 2)]
print(len(a))
print(' '.join(map(str, a)))


n = int(input())
if n == 2:
	print(1)
	print(1)
elif n == 3:
	print(2)
	print('1 3')
elif n == 4:
	print(4)
	print('3 1 4 2')
else:
	print(n)
	l = []
	for i in range(1, n + 1, 2):
		l.append(str(i))
	for i in range(2, n + 1, 2):
		l.append(str(i))
	print(' '.join(l))


n = int(input())
if n == 1:
	print(1)
	print(1)
elif n == 2:
	print(1)
	print(1)
elif n == 3:
	print(2)
	print(1, 3)
elif n == 4:
	print(4)
	print(3, 1, 4, 2)
else:
	print(n)
	for i in range(1, n + 1, 2):
		print(i, end=' ')
	for j in range(2, n + 1, 2):
		print(j, end=' ')


n = int(input())
a = 0
if n < 3:
	print(1)
	print(1)
	a = 1
if n == 3 and a == 0:
	print(2)
	print(1, 3)
	a = 1
if n == 4 and a == 0:
	print(4)
	print(3, 1, 4, 2)
	a = 1
if a == 0:
	print(n)
	for i in range(1, n + 1, 2):
		print(i, end=' ')
	for i in range(2, n + 1, 2):
		print(i, end=' ')


n = int(input())
l = []
d = []
for i in range(1, n + 1):
	if i % 2 == 0:
		l.append(i)
	else:
		d.append(i)
if n == 1:
	print(1)
	print(1)
elif n == 2:
	print(1)
	print(1)
elif n == 3:
	print(2)
	print(1, 3)
else:
	print(n)
	print(*d[::-1], *l[::-1])


import sys
n = int(input())
if n < 3:
	print(1)
	print(1)
elif n == 3:
	print(2)
	print(1, 3)
elif n == 4:
	print(4)
	print(3, 1, 4, 2)
else:
	print(n)
	i = 1
	while i <= n:
		sys.stdout.write(str(i))
		sys.stdout.write(' ')
		i += 2
	i = 2
	while i <= n:
		sys.stdout.write(str(i))
		sys.stdout.write(' ')
		i += 2


n = int(input())
o = []
e = []
for i in range(1, n + 1):
	if i % 2 == 0:
		e.append(i)
	else:
		o.append(i)
o.sort(reverse=1)
e.sort(reverse=1)
if n <= 2:
	print('1')
	print('1')
elif n == 3:
	print('2')
	print('1', '3')
else:
	print(n)
	o = o + e
	print(*o)


import itertools as ittls
from collections import Counter
import re
import math

def sqr(x):
	return x * x

def inputarray(func=int):
	return map(func, input().split())
N = int(input())
if N == 3:
	print(2)
	print(1, 3)
	quit()
elif N == 2:
	print(1)
	print(1)
	quit()
(s, t) = ([None] * N, 0)
for i in range(2, N + 1, 2):
	(s[t], t) = (i, t + 1)
for i in range(1, N + 1, 2):
	(s[t], t) = (i, t + 1)
print(N)
print(' '.join(map(str, s)))


n = int(input())
l = []
if n == 2:
	print(1)
	print(1)
	exit(0)
if n == 3:
	print(2)
	print('1 3')
	exit(0)
if n == 4:
	print(4)
	print('3 1 4 2')
	exit(0)
for i in range(1, n + 1, 2):
	l.append(i)
for i in range(2, n + 1, 2):
	l.append(i)
print(len(l))
print(' '.join(map(str, l)))


n = int(input())
a = []
b = []
k = 1
for x in range(1, n + 1):
	if k % 2 != 0:
		a.append(x)
	else:
		b.append(x)
	k += 1
if n == 1 or n == 2:
	print(1)
	print(1)
elif n == 3:
	print(2)
	print('1 3')
else:
	if a[-1] > b[-1]:
		k = a + b
	else:
		k = b + a
	print(len(k))
	print(*k)


n = int(input())
f = list(range(1, n + 1, 2))[::-1] + list(range(2, n + 1, 2))[::-1]
if n in (2, 3):
	f = f[:-1]
if n in (1, 2):
	print(1)
elif n == 3:
	print(2)
else:
	print(n)
print(' '.join((str(x) for x in f)))


num_input = input()
n = int(num_input)
if n == 1:
	print('1')
	print('1')
elif n == 2:
	print('1')
	print('1')
elif n == 3:
	print('2')
	print('1 3')
else:
	print(str(n))
	end = int(n / 2) + 1
	mid = int(n / 2) + 1
	start = 1
	while mid <= n and start < end:
		print(str(mid), end=' ')
		print(str(start), end=' ')
		mid += 1
		start += 1
	if n % 2 != 0:
		print(str(mid))


n = int(input())
if n == 1:
	print(1)
	print(1)
elif n == 2:
	print(1)
	print('1')
elif n == 3:
	print(2)
	print('1 3')
else:
	print(n)
	i = n - 1
	while i > 0:
		print(i, end=' ')
		i -= 2
	i = n
	while i > 0:
		print(i, end=' ')
		i -= 2


a = int(input())
if a <= 2:
	print(1)
	print(1)
elif a == 3:
	print(2)
	print(1, 3)
elif a == 4:
	print(4)
	print(3, 1, 4, 2)
else:
	print(a)
	for i in range(2, a + 1, 2):
		print(i, end=' ')
	for i in range(1, a + 1, 2):
		print(i, end=' ')
	print()


n = int(input())
if n == 1 or n == 2:
	print(1)
	print(1)
elif n == 3:
	print(2)
	print('1 3')
else:
	k = 2
	print(n)
	while k <= n:
		print(k, end=' ')
		k += 2
	k = 1
	while k <= n:
		print(k, end=' ')
		k += 2
	print('')


import sys
from math import *
n = int(input())
a = []
if n > 4:
	for i in range(n - 1, -1, -1):
		if i % 2 == 0:
			a = a + [i + 1]
		else:
			a = [n - i + (n % 2 == 0)] + a
	print(len(a))
	print(' '.join((str(x) for x in a)))
elif n == 4:
	print(4)
	print(2, 4, 1, 3)
elif n == 3:
	print(2)
	print(1, 3)
else:
	print(1)
	print(1)


entrada = int(input())

def solve():
	print(entrada)
	arr_a = [0] * entrada
	contador = 1
	i = 0
	while i < len(arr_a):
		arr_a[i] = contador
		contador += 1
		i += 2
	i = 1
	while i < len(arr_a):
		arr_a[i] = contador
		contador += 1
		i += 2
	for a in arr_a:
		print(a, end=' ')
	print()
if entrada == 1 or entrada == 2:
	print(1)
	print(1)
elif entrada == 3:
	print(2)
	print('1 3')
elif entrada == 4:
	print(4)
	print('2 4 1 3')
else:
	solve()


n = int(input())
if n == 2:
	print(1, '\n1')
elif n == 3:
	print(2, '\n1 3')
elif n == 4:
	print(4, '\n3 1 4 2')
elif n == 5:
	print(5, '\n3 1 4 2 5')
else:
	print(n)
	(i, j) = (1, n // 2 + 1)
	if n % 2 != 0:
		print(n, end=' ')
	while i <= n / 2:
		print(i, j, end=' ')
		i += 1
		j += 1


n = int(input())
if n == 1 or n == 2:
	print(1)
	print(1)
elif n == 3:
	print(2)
	print(1, 3)
elif n == 4:
	print(4)
	print(3, 1, 4, 2)
elif n % 2 == 0:
	print(n)
	first = list(range(1, n // 2 + 1))
	second = list(range(n // 2 + 1, n + 1))
	for i in range(len(first)):
		print('%d %d' % (first[i], second[i]), end=' ')
	print()
elif n % 2 == 1:
	print(n)
	first = list(range(1, n // 2 + 2))
	second = list(range(n // 2 + 2, n + 1))
	for i in range(len(second)):
		print('%d %d' % (first[i], second[i]), end=' ')
	print(first[-1])


n = int(input())
if n == 1 or n == 2:
	print(1, 1, sep='\n')
elif n == 3:
	print(2)
	print(1, 3)
elif n == 4:
	print(4)
	print(3, 1, 4, 2)
else:
	print(n)
	for i in range(1, n + 1, 2):
		print(i, end=' ')
	for i in range(2, n + 1, 2):
		print(i, end=' ')


n = int(input())
if n <= 2:
	print(1)
	print(1)
elif n == 3:
	print(2)
	print(1, 3)
elif n != 4:
	p = [0] * (n + 1)
	if n % 2 == 0:
		t = int(n / 2)
		for i in range(1, t + 1):
			p[2 * i - 1] = i
			p[2 * i] = t + i
	else:
		t = int(n / 2)
		for j in range(1, t + 1):
			p[2 * j - 1] = j + t
			p[2 * j] = j
			p[n] = n
	print(n)
	for k in range(1, n + 1):
		print(p[k], end=' ')
else:
	print(4)
	print(3, 1, 4, 2)


x = int(input())
if x == 1:
	print(1)
	print(1)
elif x == 2:
	print(1)
	print(1)
elif x == 3:
	print(2)
	print(1, 3)
elif x % 2 == 0:
	t = [0] * x
	for i in range(x // 2):
		t[2 * i + 1] = i + 1
	for i in range(x // 2):
		t[2 * i] = i + x // 2 + 1
	print(x)
	print(' '.join([str(x) for x in t]))
else:
	t = [0] * x
	for i in range(x // 2):
		t[2 * i + 1] = i + 1
	for i in range(x // 2):
		t[2 * i] = i + x // 2 + 1
	print(x)
	t[-1] = x
	print(' '.join([str(x) for x in t]))


n = int(input())
if n in (2, 3):
	print(n - 1)
	print(*(1, 3)[:n - 1])
else:
	print(n)
	print(*range(2, n + 1, 2), *range(1, n + 1, 2))


n = int(input())
a = []
for i in range(1, n + 1):
	a.append(i)
b = []
b.append(a[0])
for i in range(n):
	if i % 2 == 0 and i != 0:
		b.append(a[i])
for i in range(n):
	if i % 2 != 0:
		b.append(a[i])
for i in range(len(b)):
	if i + 2 < len(b):
		if abs(b[i + 1] - b[i + 2]) < 2:
			del b[i + 2]
			break
for i in range(len(b)):
	if i + 2 < len(b):
		if abs(b[i + 1] - b[i + 2]) < 2:
			del b[i + 2]
if n == 2:
	b = [1]
if n == 4:
	b = [3, 1, 4, 2]
print(len(b))
print(' '.join(map(str, b)))


n = int(input())
if n == 2:
	print(1, '\n', 1)
elif n == 3:
	print(2, '\n', 3, 1)
elif n == 4:
	print(4, '\n', '3 1 4 2')
else:
	print(n, '\n', *[i for i in range(n, 0, -2)], *[i for i in range(n - 1, 0, -2)])


n = int(input())
if n > 3:
	print(n)
	print(*[i * 2 + 2 for i in range(n // 2)] + [i * 2 + 1 for i in range(n - n // 2)])
elif n == 3:
	print('2\n1 3')
elif n == 2:
	print('1\n1')
else:
	print('1\n1')


n = int(input())
if n > 3:
	l = []
	for i in range(2, n + 1, 2):
		l.append(i)
	for i in range(1, n + 1, 2):
		l.append(i)
	print(len(l))
	print(*l)
else:
	l = [i for i in range(n, 0, -2)]
	print(len(l))
	print(*l)


def main():
	n = int(input())
	if n <= 3:
		r = list(range(1, n + 1)[::2])
	else:
		r = list(range(1, n + 1)[1::2]) + list(range(1, n + 1)[::2])
	print(len(r))
	print(' '.join((str(i) for i in r)))
main()


n = int(input().rstrip())
ans = ''
if n > 3:
	ans += str(n)
	for i in range(1, n):
		if i % 2 == 0:
			ans += ' ' + str(i)
		else:
			ans = str(i) + ' ' + ans
	print(n)
	print(ans)
elif n == 3:
	print(2)
	print('1 3')
elif n == 2 or n == 1:
	print(1)
	print('1')


n = int(input())
a = list(range(2, n + 1, 2)) + list(range(1, n + 1, 2))
if n > 1 and n < 4:
	a = a[1:]
print(len(a))
for x in a:
	(print(x),)


from functools import reduce
from sys import stdin
file = stdin

def read_line():
	return file.readline().strip()

def read_int():
	return int(read_line())

def string_list_to_int_list(x):
	return [int(e) for e in x]
n = read_int()
if n == 1:
	a = [1]
elif n == 2:
	n = 1
	a = [1]
elif n == 3:
	n = 2
	a = [1, 3]
elif n == 4:
	n = 4
	a = [2, 4, 1, 3]
else:
	even = list(range(0, n, 2))
	odd = list(range(1, n, 2))
	a = odd + even
	a = list(map(lambda x: x + 1, a))
print(n)
print(' '.join(map(str, a)))


n = int(input())
if n == 3:
	print(2)
	print('1 3')
	exit()
if n == 2:
	print(1)
	print(1)
	exit()
a = []
b = []
for i in range(1, n + 1):
	if i % 2 == 0:
		a.append(i)
	else:
		b.append(i)
c = a + b
print(n)
print(' '.join(map(str, c)))


(n, array) = (int(input()), [])
o = n
if n > 5:
	if n % 2 == 1:
		n -= 1
	for i in range(1, n + 1):
		if i % 2 == 1:
			array.append(n - i)
		else:
			array.append(i)
	j = len(array) // 2 - 1
	(a, b, c) = (array.pop(j), array.pop(j), array.pop(j))
	array.insert(0, a)
	array.append(b)
	array.insert(0, c)
	if o % 2 == 1:
		n += 1
		array.append(o)
	print(n)
	print(' '.join((str(x) for x in array)))
if n == 5:
	print(5)
	print('3 5 1 4 2')
if n == 4:
	print(4)
	print('3 1 4 2')
if n == 3:
	print(2)
	print('1 3')
if n == 2 or n == 1:
	print(1)
	print('1')


import math

def fact(n):
	ans = 1
	for i in range(2, n + 1):
		ans *= i
	return ans

def comb(n, c):
	return fact(n) // (fact(n - c) * c)
n = int(input())
if n == 1 or n == 2:
	print(1)
	print(1)
elif n == 3:
	print(2)
	print(1, 3)
elif n == 4:
	print(4)
	print(3, 1, 4, 2)
else:
	ans = []
	for i in range(1, n + 1, 2):
		ans.append(str(i))
	for i in range(2, n + 1, 2):
		ans.append(str(i))
	print(len(ans))
	print(' '.join(ans))


n = int(input())
if n == 1:
	print('1')
	print('1')
elif n == 2:
	print('1')
	print('1')
elif n == 3:
	print('2')
	print('1 3')
elif n >= 4:
	l = list()
	print(n)
	if n % 2 == 0:
		j = n
		i = n - 1
	else:
		j = n - 1
		i = n
	while i > 0:
		l.append(i)
		i = i - 2
	while j > 0:
		l.append(j)
		j = j - 2
	print(*l)


import sys
import time
import itertools
import math

def inp():
	ln = input().split()
	return int(ln[0]) if len(ln) == 1 else [int(i) for i in ln]

def pr(x):
	if isinstance(x, list):
		print(' '.join([str(i) for i in x]))
	else:
		print(x)

def finish(x):
	pr(x)
	sys.exit()
n = inp()
a = []
if n == 1:
	print(1)
	print(1)
elif n == 2:
	print(1)
	print(1)
elif n == 4:
	print(4)
	print('2 4 1 3')
else:
	i = 1
	while i <= n:
		a.append(i)
		i += 2
	i = 2
	while i <= n:
		if abs(i - a[-1]) != 1:
			a.append(i)
		i += 2
	print(len(a))
	print(' '.join([str(i) for i in a]))


n = int(input())
if n == 1:
	print(1)
	print(1)
elif n == 2:
	print(1)
	print(2)
elif n == 3:
	print(2)
	print(*[1, 3])
elif n == 4:
	print(4)
	print(*[3, 1, 4, 2])
else:
	L = [0] * n
	i = 0
	j = 1
	while j <= n:
		L[i] = j
		j += 2
		i += 1
	j = 2
	while j <= n:
		L[i] = j
		i += 1
		j += 2
	print(len(L))
	print(*L)


n = int(input())
if n != 2 and n != 3:
	print(n)
	a = [0] * n
	l = n // 2 + 1
	k = 1
	for i in range(n):
		if i % 2 == 0:
			a[i] = l
			l += 1
		else:
			a[i] = k
			k += 1
	print(*a)
elif n == 2:
	print(1)
	print(1)
elif n == 3:
	print(2)
	print(1, 3)


n = int(input())
if n == 1:
	print(n)
	print(n)
elif n == 4:
	print(n)
	print('3 1 4 2')
else:
	x = [i for i in range(1, n + 1) if i % 2 != 0]
	y = [i for i in range(1, n + 1) if i % 2 == 0]
	if abs(x[len(x) - 1] - y[0]) != 1:
		d = x + y
	else:
		d = x
	print(len(d))
	print(*d)


n = int(input())
if n == 1:
	print(1)
	print(1)
elif n == 2:
	print(1)
	print(2)
elif n == 3:
	print(2)
	print(1, 3)
elif n == 4:
	print(4)
	print(2, 4, 1, 3)
else:
	print(n)
	odd = 1
	even = 2
	for i in range(n):
		if odd <= n:
			print(odd, end=' ')
			odd += 2
		elif even <= n:
			print(even, end=' ')
			even += 2


a = int(input())
if a <= 2:
	print('1\n1')
elif a == 3:
	print('2\n1 3')
elif a == 4:
	print('4\n2 4 1 3')
else:
	print(a, ' '.join(map(str, list(range(1, a + 1, 2)) + list(range(2, a + 1, 2)))), sep='\n')


n = int(input())
arr = []
for i in range(n - (1 - n % 2), 0, -2):
	arr.append(i)
for i in range(n - n % 2, 1, -2):
	if abs(i - arr[-1]) != 1:
		arr.append(i)
print(len(arr))
for i in arr:
	print(i, end=' ')


n = int(input(''))
c = n - 1
b = n
a = [] * n
if n == 2:
	print('1')
	print('1')
elif n == 3:
	print('2')
	print('1 3')
else:
	if n % 2 == 0:
		b = n - 1
		c = n
	while 1:
		if b <= 0:
			break
		else:
			a.append(b)
		b -= 2
	while 1:
		if c <= 0:
			break
		else:
			a.append(c)
		c -= 2
	print(len(a))
	for i in range(0, len(a)):
		print(a[i], end=' ')


n = int(input())
ans = []
if n <= 4:
	if n == 1 or n == 2:
		ans.append(1)
	elif n == 3:
		ans.append(1)
		ans.append(3)
	else:
		ans.append(2)
		ans.append(4)
		ans.append(1)
		ans.append(3)
else:
	for i in range(1, n + 1, 2):
		ans.append(i)
	for i in range(2, n + 1, 2):
		ans.append(i)
print(len(ans))
ans = [str(x) for x in ans]
ans = ' '.join(ans)
print(ans)


N = int(input())
Answer = [[1, [1]], [1, [1]], [2, [1, 3]], [4, [3, 1, 4, 2]]]
if N <= 4:
	print(Answer[N - 1][0])
	print(*Answer[N - 1][1])
	exit()
print(N)
print(*list(filter(lambda x: x % 2 == 1, range(1, N + 1))), end=' ')
print(*list(filter(lambda x: x % 2 == 0, range(1, N + 1))), end=' ')


n = int(input())
a = list(range(1, n + 1))
x = a[::2] + a[1::2]
y = a[1::2] + a[::2]
x = [x[i] for i in range(n) if i == 0 or abs(x[i] - x[i - 1]) > 1]
y = [y[i] for i in range(n) if i == 0 or abs(y[i] - y[i - 1]) > 1]
if len(x) >= len(y):
	print(len(x))
	print(' '.join(map(str, x)))
else:
	print(len(y))
	print(' '.join(map(str, y)))


n = int(input())
a = []
if n == 2:
	print(1)
	print(1)
	exit()
if n == 3:
	print(2)
	print(1, 3)
	exit()
curr = 0
if n & 1:
	curr = n
else:
	curr = n - 1
for i in range(n):
	if curr < 0:
		if n & 1:
			curr = n - 1
		else:
			curr = n
	a.append(curr)
	curr -= 2
print(n)
for i in a:
	print(i, end=' ')


n = int(input().strip())
if 2 >= n:
	print(1)
	print(1)
elif 3 == n:
	print(2)
	print('1 3')
else:
	print(n)
	sits = [1]
	place = 0
	for i in range(n, 1, -1):
		if 0 == place:
			sits.append(i)
		else:
			sits = [i] + sits
		place = (place + 1) % 2
	print(' '.join(map(str, sits)))


a = int(input(''))
b = []
num = a
for x in range(a):
	if (x + 1) % 2 == 0:
		b.append(x + 1)
ans = []
for val in range(a):
	if (val + 1) % 2 == 1:
		ans.append(val + 1)
for value in b:
	ans.append(value)
if a == 3:
	num = 2
	ans = [1, 3]
if a == 2:
	num = 1
	ans = [1]
if a == 1:
	num = 1
	ans = [1]
if a == 4:
	num = 4
	ans = [3, 1, 4, 2]
print(num)
strs = ''
for val in ans:
	strs = strs + str(val) + ' '
print(strs[0:len(strs) - 1])


n = int(input())
if n <= 2:
	print(1)
	print(1)
elif n == 3:
	print(2, '\n', *[1, 3])
else:
	(a, b) = ([i for i in range(1, n + 1, 2)], [i for i in range(2, n + 1, 2)])
	print(n)
	print(*a[::-1], *b[::-1])


def func(n):
	if n == 1 or n == 2:
		return (1, [1])
	if n == 3:
		return (2, [1, 3])
	t = [None] * n
	i = 0
	k = 2
	while k <= n:
		t[i] = k
		k += 2
		i += 1
	k = 1
	while k <= n:
		t[i] = k
		k += 2
		i += 1
	return (n, t)
n = int(input())
(p, q) = func(n)
print(p)
for i in range(len(q)):
	print(q[i], end=' ')


import functools
n = int(input())
if n == 1 or n == 2:
	print(1)
	print(1)
	exit(0)
elif n == 3:
	print(2)
	print(1, 3)
	exit(0)
odds = list(filter(lambda x: True if x % 2 == 1 else False, range(1, n + 1)))
evens = list(filter(lambda x: True if x % 2 == 0 else False, range(1, n + 1)))
odds.reverse()
evens.reverse()
od = ' '.join(map(str, odds))
ev = ' '.join(map(str, evens))
print(n)
print(od + ' ' + ev)


n = int(input())
r = ''
if n != 2 and n != 3:
	print(n)
	for i in range(2, n + 1, 2):
		r += str(i)
		r += ' '
	for i in range(1, n + 1, 2):
		r += str(i)
		r += ' '
	print(r)
elif n == 2:
	print(1)
	print(1)
else:
	print(2)
	print('1 3')


n = int(input())
res = []
odds = []
evens = []
if n == 1:
	res = [1]
else:
	for i in range(1, n + 1):
		if i % 2 == 0:
			evens.append(i)
		else:
			odds.append(i)
	if abs(odds[-1] - evens[0]) > 1:
		res = odds + evens
	elif abs(odds[0] - evens[-1]) > 1:
		res = evens + odds
	elif len(odds) > len(evens):
		res = odds
	else:
		res = evens
res_str = []
for i in res:
	res_str.append(str(i))
print(len(res))
print(' '.join(res_str))


z = int(input())
if 2 + 2 <= z:
	print(z)
	for i in range(2, z + 1, 2):
		print(i, end=' ')
else:
	print(['1', '%d' % (z - 1)][z > 1])
for i in range(1, z + 1, 2):
	print(i, end=' ')


n = int(input())
s = list(range(1, n + 1))
if len(s) == 1 or len(s) == 2:
	print(1)
	print(1)
elif len(s) == 3:
	print(2)
	print('1 3')
else:
	print(n)
	j = ''
	m = ''
	for i in range(n):
		if s[i] % 2 == 0:
			j += str(s[i]) + ' '
		else:
			m += str(s[i]) + ' '
	print(j + m)


n = int(input())
if n == 1 or n == 2:
	print(1)
	print(1)
elif n == 3:
	print(2)
	print('1 3')
elif n == 4:
	print(4)
	print('3 1 4 2')
else:
	a = []
	for i in range(1, n + 1, 2):
		a.append(i)
	for i in range(2, n + 1, 2):
		a.append(i)
	print(len(a))
	print(' '.join(map(str, a)))


def fun():
	n = int(input())
	answer = []
	if n <= 2:
		print(1)
		print(1)
		return
	if n == 3 or n % 2 == 0:
		for i in range(n // 2):
			answer.insert(0, 1 + i * 2)
			answer.append(n - i * 2)
		print(len(answer))
		print(*answer)
		return
	else:
		for i in range(n // 2):
			answer.insert(0, 1 + i * 2)
			answer.append(n - 1 - i * 2)
		answer.insert(0, n)
		print(len(answer))
		print(*answer)
		return
fun()


from sys import stdin, stdout
from math import *
from itertools import *
lmap = lambda x, y: list(map(x, y))
lfilter = lambda x, y: list(filter(x, y))

def solve(test):
	n = int(test.strip())
	if n <= 2:
		return '1\n1'
	elif n == 3:
		return '2\n1 3'
	elif n == 4:
		return '4\n2 4 1 3'
	else:
		return str(n) + '\n' + ' '.join(lmap(str, list(range(1, n + 1, 2)) + list(range(2, n + 1, 2))))
stdout.write(str(solve(stdin.read())))


n = int(input())
if n > 4:
	print(n)
	a = []
	for i in range(0, n, 2):
		a.append(i + 1)
	for i in range(1, n, 2):
		a.append(i + 1)
	for i in range(n - 1):
		print(a[i], end=' ')
	print(a[n - 1])
elif n < 3:
	print(1, 1, sep='\n')
elif n == 3:
	print(2, '1 3', sep='\n')
else:
	print(4, '3 1 4 2', sep='\n')


s = int(input())
v1 = list(range(1, s + 1, 2))
v2 = list(range(2, s + 1, 2))
if s == 1 or s == 2:
	print('1\n1')
	exit()
if s == 3:
	print('2\n1 3')
	exit()
v1 = v2 + v1
print(len(v1))
print(' '.join(map(str, v1)))


n = int(input())
if n == 1:
	print(1)
	print(1)
else:
	odd = [int(k) for k in range(n + 1) if k % 2 != 0]
	odd.reverse()
	even = [int(k) for k in range(1, n + 1) if k % 2 == 0]
	even.reverse()
	odd_len = len(odd)
	if abs(odd[odd_len - 1] - even[0]) == 1:
		even = even[1:]
	num = odd + even
	print(len(num))
	num = [str(k) for k in num]
	print(' '.join(num))


n = input('')
n = int(n)
if n == 3:
	print('2\n1 3')
elif n == 4:
	print('4\n2 4 1 3')
elif n == 2:
	print('1\n1')
else:
	print(n)
	(print('1', end=''),)
	for i in range(3, n + 1, 2):
		(print(' ', end=''),)
		print(i, end='')
	for i in range(2, n + 1, 2):
		(print(' ', end=''),)
		(print(i, end=''),)
	print('')


n = int(input())
if n == 1 or n == 2:
	print(1)
	print(1)
elif n == 3:
	print(2)
	print(1, 3)
else:
	z = []
	for i in range(n // 2):
		z.append(n // 2 + i + 1)
		z.append(i + 1)
	if n % 2 == 1:
		z.append(n)
	print(n)
	print(*z)


def printanswer(answer):
	for a in answer:
		print(a, end=' ')
	print()
n = int(input())
if n == 1 or n == 2:
	print(1)
	print(1)
elif n == 3:
	print(2)
	printanswer([1, 3])
elif n == 4:
	print(4)
	printanswer([3, 1, 4, 2])
else:
	l = []
	for i in range(1, n + 1):
		l.append(i)
	answer = [0] * n
	i = 0
	j = n - 1
	current = 0
	while i < j and current < n - 1:
		answer[current] = l[i]
		answer[current + 1] = l[j]
		i += 1
		j -= 1
		current += 2
	if i == j:
		answer[current] = l[i]
	(answer[0], answer[n - 1]) = (answer[n - 1], answer[0])
	print(len(answer))
	printanswer(answer)


import math
n = int(input())
if n <= 2:
	ans = [1]
elif n == 3:
	ans = [1, 3]
elif n == 4:
	ans = [3, 1, 4, 2]
else:
	ans = [2 * i + 1 for i in range(math.ceil(n / 2))] + [2 * i + 2 for i in range(n // 2)]
print(len(ans))
print(*ans)


n = int(input())
if n == 1 or n == 2:
	print(1)
	print(1)
if n == 3:
	print(2)
	print(1, 3)
if n > 3:
	l = [x for x in range(1, n + 1) if x % 2 == 1]
	r = [x for x in range(1, n + 1) if x % 2 == 0]
	l.reverse()
	r.reverse()
	print(n)
	ans = l + r
	print(*ans)


n = int(input())
a = []
if n > 4:
	for i in range(n - 1, -1, -1):
		if i % 2 == 0:
			a = a + [i + 1]
		else:
			a = [n - i + (n % 2 == 0)] + a
	print(len(a))
	print(' '.join((str(x) for x in a)))
elif n == 4:
	print(4)
	print(2, 4, 1, 3)
elif n == 3:
	print(2)
	print(1, 3)
else:
	print(1)
	print(1)


n = input()
n = int(n)
array = []
if n == 1 or n == 2:
	print(1)
	print(1)
elif n == 3:
	print(2)
	print(1, 3)
elif n % 2 == 0:
	a = n // 2
	b = n
	k = 0
	for i in range(0, n // 2):
		array.extend([a, b])
		a -= 1
		b -= 1
		k += 2
	print(k)
	print(*array)
else:
	x = n - 1
	a = x // 2
	b = x
	k = 1
	for i in range(0, x // 2):
		array.extend([a, b])
		a -= 1
		b -= 1
		k += 2
	print(k)
	array.append(n)
	print(*array)


n = int(input())
x = []
if n == 1:
	print('1')
	print('1')
elif n == 4:
	print('4')
	print('3 1 4 2')
else:
	for i in range(1, n + 1):
		j = int(i)
		x.append(j)
	for i in range(1, n + 1):
		if int(i) % 2 == 0:
			x.remove(i)
			x.append(i)
	if n < 4:
		x.remove(x[-1])
	print(len(x))
	for i in x[:-1]:
		print(i, end=' ')
	print(x[-1])


def solve(n):
	if n == 1:
		print(1)
		print(1)
	elif n == 2:
		print(1)
		print(1)
	elif n == 3:
		print(2)
		print('1 3')
	elif n >= 4:
		seed = [3, 1, 4, 2]
		for i in range(5, n + 1):
			if i % 2:
				seed.append(i)
			else:
				seed = [i] + seed
		print(n)
		print(' '.join(map(str, seed)))
n = int(input())
solve(n)


n = int(input())
l = list(range(n, 0, -1))
if n >= 4:
	new = []
	new_2 = []
	for i in l:
		if i & 1:
			new.append(i)
		else:
			new_2.append(i)
	print(n)
	print(*new + new_2)
elif n == 1 or n == 2:
	print(1)
	print(1)
else:
	print(2)
	print(1, 3)


N = int(input(''))
if N % 2 == 0:
	diff = int(N / 2)
else:
	diff = int((N + 1) / 2)
l = []
if N == 1 or N == 2:
	print(1)
	print(1)
elif N == 3:
	print(2)
	print(1, 3)
elif N == 4:
	print(4)
	print(3, 1, 4, 2)
else:
	for i in range(1, diff + 1):
		l.append(int(i))
		l.append(int(i + diff))
	if N % 2 == 1:
		l.pop()
	print(len(l))
	output = ''
	for i in range(0, N):
		output += str(l[i]) + ' '
	print(output.rstrip())


n = int(input())
list = []
if n == 2:
	print(1)
	print(1)
elif n == 3:
	print(2)
	print(1, ' ', 3)
elif n == 4:
	print(4)
	print(3, 1, 4, 2)
else:
	i = 1
	while i <= n:
		list.append(i)
		i += 2
	i = 2
	while i <= n:
		list.append(i)
		i += 2
	print(n)
	for i in range(n):
		print(list[i], end=' ')


n = int(input())
if n == 3:
	print(2)
	print(1, 3)
elif n <= 2:
	print(1)
	print(1)
else:
	print(n)
	for i in reversed(range(1, n + 1, 2)):
		print(i, end=' ')
	for i in reversed(range(2, n + 1, 2)):
		print(i, end=' ')


n = int(input())
l = [i for i in range(2, n + 1, 2)] + [i for i in range(1, n + 1, 2)]
if n > 1 and n < 4:
	l = l[1:]
print(len(l))
print(*l)


n = int(input())
if n == 2:
	print(1, '\n', 1, sep='')
elif n == 3:
	print(2, '\n', '1 ', 3, sep='')
else:
	a = [x for x in range(1, n + 1, 2)][-1::-1]
	b = [x for x in range(2, n + 1, 2)][-1::-1]
	print(len(a + b))
	print(*a, *b)


n = int(input())
result = ''
k = 0
if n == 1 or n == 2:
	print('1')
	print('1')
	exit()
elif n == 3:
	print('2')
	print('3 1')
	exit()
for i in reversed(range(1, n + 1, 2)):
	result += '%s ' % str(i)
	k += 1
for j in reversed(range(2, n + 1, 2)):
	result += '%s ' % str(j)
	k += 1
print(k)
print(result)


n = int(input())
if n == 1:
	res = [1]
else:
	(even, odd) = (list(range(2, n + 1, 2)), list(range(1, n + 1, 2)))
	(l, r) = sorted((even, odd), key=lambda c: c[-1], reverse=True)
	while r and abs(l[-1] - r[0]) == 1:
		r.pop(0)
	res = l + r
print(len(res))
print(str.join(' ', list(map(str, res))))


a = int(input())
if a == 1 or a == 2:
	print(1)
	print(1)
elif a == 3:
	print(2)
	print(1, 3)
elif a == 4:
	print(4)
	print(3, 1, 4, 2)
else:
	print(a)
	b = []
	for i in range(a // 2 + a % 2):
		b.append(i * 2 + 1)
	for k in range(a // 2):
		b.append(k * 2 + 2)
	print(*b)


n = int(input())
if n <= 2:
	print('1\n1')
elif n == 3:
	print('2\n1 3')
else:
	print(n)
	a = [i for i in range(2, n + 1, 2)] + [i for i in range(1, n + 1, 2)]
	a = list(map(str, a))
	print(' '.join(a))


x = int(input())
s = [n for n in range(1, x + 1)]
z = []
t = []
for n in s:
	if n % 2 == 1:
		z.append(n)
	else:
		t.append(n)
z.sort()
t.sort()
m = z[::-1] + t[::-1]
if x % 2 == 1 and x != 1:
	if abs(m[x // 2] - m[x // 2 + 1]) == 1:
		del m[x // 2]
if x == 1:
	m = [1]
if x == 3:
	m = [1, 3]
if x == 2:
	m = [1]
print(len(m))
for n in m:
	print(n, end=' ')


def f(n):
	l = [None, [[1], [1]], [[1], [1]], [[2], [1, 3]]]
	if n < 4:
		return l[n]
	ol = list(range(1, n + 1, 2))
	ol.reverse()
	el = list(range(2, n + 1, 2))
	el.reverse()
	return [[n], ol + el]
[print(*r) for r in f(int(input()))]


n = int(input())
a = []
if n % 2 == 0:
	b = n - 1
else:
	b = n
for i in range(b, 0, -2):
	a.append(i)
b = n // 2 * 2
while abs(b - a[-1]) != 1 and b > 1:
	a.append(b)
	b -= 2
print(len(a))
print(' '.join(map(str, a)))


import math
n = int(input())
l = math.floor(n / 2) + 1
k = 1
a = [0] * n
if n == 2:
	print(1)
	print(1)
	exit(0)
if n == 3:
	print(2)
	print(1, end=' ')
	print(3, end='')
	exit(0)
else:
	for i in range(n):
		if i % 2 == 0:
			a[i] = l
			l += 1
		else:
			a[i] = k
			k += 1
	print(len(a))
	print(*a)


n = int(input())
if n < 3:
	a = [1]
elif n < 4:
	a = (1, 3)
else:
	(y, a) = (0, [3, 1, 4, 2])
	for i in range(5, n + 1):
		a.insert(len(a) * y, i)
		y = 1 - y
print(len(a))
for i in a:
	print(i, end=' ')


N = int(input())
if N <= 2:
	print('1\n1')
elif N == 3:
	print('2\n1 3')
elif N == 4:
	print('4\n2 4 1 3')
else:
	print(N)
	for I in range(1, N + 1, 2):
		print(I)
	for I in range(2, N + 1, 2):
		print(I)


n = int(input())
a = list(range(2, n + 1, 2)) + list(range(1, n + 1, 2))
if n > 1 and n < 4:
	a = a[1:]
print(len(a))
print(' '.join(map(str, a)))


n = int(input())
ans = list(range(1, n + 1, 2))[::-1] + list(range(2, n + 1, 2))[::-1]
ans2 = [ans[0]]
for i in range(1, len(ans)):
	if abs(ans[i] - ans2[-1]) > 1:
		ans2.append(ans[i])
print(len(ans2))
print(*ans2)


n = int(input())
if n == 1 or n == 2:
	print(1)
	print(1)
elif n == 3:
	print(2)
	print(1, 3)
elif n == 4:
	print(4)
	print(3, 1, 4, 2)
elif n == 5:
	print(5)
	print(5, 3, 1, 4, 2)
else:
	print(n)
	n2 = n // 2
	a = [str(i) + ' ' + str(n2 + i) for i in range(1, n2 + 1)]
	ans = ' '.join(a)
	if n % 2 == 1:
		ans = str(n) + ' ' + ans
	print(ans)


def answer(num):
	if num == 0:
		return [0, ' ']
	if num == 1:
		return [1, '1']
	if num == 2:
		return [1, '2']
	if num == 3:
		return [2, '1 3']
	if num == 4:
		return [4, '3 1 4 2']
	start = 1
	if num % 2 == 0:
		mid = int(start + num / 2)
	else:
		mid = int(start + num / 2 + 1)
	ans = ''
	k = 0
	mid_f = 0
	while 1:
		ans += str(start)
		start += 1
		if mid_f == 0:
			ans += ' ' + str(mid) + ' '
			mid += 1
		if mid == num + 1:
			mid_f = 1
		if start >= num / 2 + 1:
			break
	return [num, ans]
num = int(input())
a = answer(num)
print(a[0])
print(a[1])


n = int(input())
if n == 1 or n == 2:
	print('1\n1')
elif n == 3:
	print('2\n1 3')
elif n == 4:
	print('4\n3 1 4 2')
elif n == 5:
	print('5\n1 4 2 5 3')
else:
	half = n // 2
	print(n)
	if n % 2:
		print(str(n) + ' ', end='')
	for i in range(1, half + 1):
		print(str(i) + ' ' + str(half + i) + ' ', end='')


import sys
n = int(input())
if n == 4:
	print(4)
	print(3, 1, 4, 2)
	return
out = []
for i in range(0, n, 2):
	out.append(i + 1)
if not abs(out[-1] - 2) == 1:
	for i in range(1, n, 2):
		out.append(i + 1)
print(len(out))
print(' '.join(map(str, out)))


n = int(input())
if n == 1 or n == 2:
	print('1\n1')
elif n == 3:
	print('2\n1 3')
else:
	s = []
	for i in range(1, (n + 1) // 2 + 1):
		s.append(i)
		if n % 2 == 0:
			s.append(n - i + 1)
		elif i < (n + 1) // 2:
			s.append(n - i + 1)
	print(len(s))
	w = s.pop()
	print(w, *s)


import sys
I = sys.stdin.readline
n = int(I())
if n < 3:
	print(1)
	print(1)
elif n == 3:
	print(2)
	print(1, 3)
else:
	even = []
	odd = []
	for i in range(1, n + 1):
		if i % 2:
			odd.append(i)
		else:
			even.append(i)
	print(n)
	print(*even + odd)


x = int(input())
y = list(range(2, x + 1, 2)) + list(range(1, x + 1, 2))
if 1 < x < 4:
	y = y[1:]
print(len(y))
print(' '.join(map(str, y)))


n = int(input())
t = [i for i in range(n, 0, -1) if i % 2 != 0] + [i for i in range(n, 0, -1) if i % 2 == 0]
if n == 2:
	print('1', '1', sep='\n')
elif n == 3:
	print('2', '1 3', sep='\n')
else:
	print(len(t))
	print(*t)


n = int(input())
even = [x for x in range(2, n + 1, 2)]
odd = [x for x in range(1, n + 1, 2)]
students = []
if n == 2:
	print(1)
	print(1)
elif n == 3:
	print(2)
	print(1, 3)
else:
	print(len(even[::-1] + odd[::-1]))
	print(*odd[::-1] + even[::-1])


n = int(input())
if n < 3:
	print(1)
	print(1)
elif n == 3:
	print(2)
	print(1, 3)
elif n == 4:
	print(4)
	print(3, 1, 4, 2)
else:
	print(n)
	print(*list(range(n, 0, -2)) + list(range(n - 1, 0, -2)))


while True:
	try:
		n = int(input())
	except:
		break
	if n == 1:
		print(1)
		print(1)
	elif n == 2:
		print(1)
		print(2)
	elif n == 3:
		print(2)
		print(1, end=' ')
		print(3)
	elif n == 4:
		print(4)
		print(3, end=' ')
		print(1, end=' ')
		print(4, end=' ')
		print(2)
	else:
		print(n)
		if n % 2 == 0:
			for i in range(n, 1, -2):
				print(i, end=' ')
			for i in range(n - 1, 0, -2):
				print(i, end=' ')
			print('')
		else:
			for i in range(n, 0, -2):
				print(i, end=' ')
			for i in range(n - 1, 1, -2):
				print(i, end=' ')
			print('')


n = int(input())
if n <= 2:
	print('1\n1')
	exit()
if n == 3:
	print('2\n1 3')
	exit()
ans = []
print(n)
for i in range(n // 2):
	ans.append(str(i + 1))
	ans.append(str(n - (i + 1) + 1))
if n % 2:
	print(' '.join([str(n // 2 + 1)] + ans))
else:
	print(' '.join([str(n // 2 + 1)] + ans[:n - 1]))


n = int(input())
if n <= 2:
	r = [1]
elif n == 3:
	r = [1, 3]
elif n == 4:
	r = [3, 1, 4, 2]
else:
	i = 1
	r = []
	while i <= n // 2 - 1:
		r.append(i)
		r.append(n - i)
		i += 1
	if n % 2:
		r.append(i)
	r.append(n)
	r.append((n + 1) // 2)
print(len(r))
print(' '.join(map(str, r)))


n = int(input())
if n == 1:
	print(1)
	print(1)
elif n == 2:
	print(1)
	print(1)
elif n == 3:
	print(2)
	print('1 3')
else:
	l = [0] * 6000
	if n % 2 == 0:
		cur = 0
		temp = n // 2
		for i in range(0, n // 2):
			l[cur] = temp
			cur += 1
			temp -= 1
		temp = n
		for i in range(0, n // 2):
			l[cur] = temp
			cur += 1
			temp -= 1
		cur = n // 2 - 2
		temp = 1
		while cur >= 0:
			t = l[n // 2 - 1 - temp]
			l[n // 2 - 1 - temp] = l[n // 2 + temp]
			l[n // 2 + temp] = t
			temp += 2
			cur -= 2
	else:
		cur = 0
		temp = n // 2
		for i in range(0, n // 2):
			l[cur] = temp
			cur += 1
			temp -= 1
		l[cur] = n // 2 + 1
		cur += 1
		temp = n
		for i in range(0, n // 2):
			l[cur] = temp
			cur += 1
			temp -= 1
		cur = n // 2 - 2
		temp = 1
		while cur >= 0:
			t = l[n // 2 - 1 - temp]
			l[n // 2 - 1 - temp] = l[n // 2 + 1 + temp]
			l[n // 2 + 1 + temp] = t
			temp += 2
			cur -= 2
	print(n)
	for i in range(0, n):
		print(l[i], end=' ')


n = int(input())
res = ([], list(range(2, n + 1, 2)))[n > 3] + list(range(1, n + 1, 2))
print(len(res))
print(' '.join(map(str, res)))


n = int(input())
if n == 1 or n == 2:
	print('1')
	print('1')
	exit(0)
if n == 3:
	print('2')
	print('1 3')
	exit(0)
n1 = list(range(1, n + 1, 2))[::-1]
n2 = list(range(2, n + 1, 2))[::-1]
print(n)
print(' '.join(map(str, n1)) + ' ' + ' '.join(map(str, n2)))


n = int(input())
if n == 2 or n == 1:
	print(1)
	print(1)
elif n == 3:
	print(2)
	print('1 3')
else:
	s1 = ''
	s2 = ''
	for i in range(1, n + 1):
		if i % 2 == 0:
			s1 += str(i) + ' '
		else:
			s2 += str(i) + ' '
	print(n)
	print(s1 + s2)


import sys
inf = float('inf')
from math import ceil, floor, log, sqrt, factorial, pow, pi, gcd
abc = 'abcdefghijklmnopqrstuvwxyz'
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
(mod, MOD) = (1000000007, 998244353)
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def get_array():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def input():
	return sys.stdin.readline().strip()
n = int(input())
if n == 1 or n == 2:
	print(1)
	print(1)
elif n == 3:
	print(2)
	print(1, 3)
elif n == 4:
	print(4)
	print(3, 1, 4, 2)
else:
	result = []
	for i in range(1, n + 1):
		if i & 1:
			result.append(i)
	for i in range(1, n + 1):
		if i % 2 == 0:
			result.append(i)
	print(len(result))
	print(*result, sep=' ')


edge_cases = {2: (1, '1'), 3: (2, '1 3'), 4: (4, '2 4 1 3')}
n = int(input())
if n in edge_cases:
	(size, answer) = edge_cases[n]
	print(size)
	print(answer)
else:
	print(n)
	for i in range(1, n + 1, 2):
		print(i, end=' ')
	for i in range(2, n + 1, 2):
		print(i, end=' ')


n = int(input())
ans = []
for i in range(n // 2):
	ans += [str(i + 1)]
	ans += [str(n - i)]
if n != 3 and n % 2:
	ans += [str(n // 2 + 1)]
if n == 1 or n == 2:
	print('\n'.join(['1', '1']))
elif n == 3:
	print(2)
	print(ans[-1], ' '.join(ans[:-1]))
else:
	print(n)
	print(ans[-1], ' '.join(ans[:-1]))


a = []
for i in range(6000):
	a = a + [i]
inp = int(input())
if inp == 1 or inp == 2:
	print(1)
	print(1)
elif inp == 3:
	print(2)
	print(1, 3)
else:
	print(inp)
	print(2, end='')
	for i in a[4:inp + 1:2]:
		print(' ', i, end='')
	for i in a[1:inp + 1:2]:
		print(' ', i, end='')
	print()


def main():
	n = int(input())
	if n < 5:
		(n, res) = ((1, (1,)), (1, (1,)), (2, (1, 3)), (4, (3, 1, 4, 2)))[n - 1]
	else:
		res = []
		n2 = (n + 1) // 2
		for i in range(1, n2 + 1):
			res.append(i)
			res.append(i + n2)
		if n & 1:
			del res[-1]
	print(n)
	print(' '.join(map(str, res)))
main()


from sys import stdin, stdout, stderr, setrecursionlimit
import inspect, re
setrecursionlimit(100000)

def debug(*e):
	if not __debug__:
		print(*e, file=stderr)

def dd(*vals):
	frame = inspect.getframeinfo(inspect.stack()[1][0])
	vs = re.search('dd\\((.+)\\)', frame.code_context[0]).group(1).split(',')
	if vs:
		debug(','.join(('{0} = {1}'.format(vs[i], v) for (i, v) in enumerate(vals))))

def trace(f):

	def traced(*args, **kw):
		debug('calling {} with args {}, {}'.format(f.__name__, args, kw))
		return f(*args, **kw)
	return traced

def read():
	return stdin.readline().rstrip()

def readarr(sep=None, maxsplit=-1):
	return read().split(sep, maxsplit)

def readint():
	return int(read())

def readintarr(sep=None, maxsplit=-1):
	return [int(a) for a in readarr(sep, maxsplit)]

def write(*args, **kwargs):
	sep = kwargs.get('sep', ' ')
	end = kwargs.get('end', '\n')
	stdout.write(sep.join((str(a) for a in args)) + end)

def writearr(arr, sep=' ', end='\n'):
	stdout.write(sep.join((str(a) for a in arr)) + end)
from itertools import chain
n = readint()
disp = set(range(2, n + 1))
ans = [1]
A = []
avance = True
while disp:
	if avance:
		sigs = chain(range(ans[-1] + 3, n + 1), [ans[-1] + 2])
	else:
		sigs = range(ans[-2] + 1, n + 1)
	for x in sigs:
		if x in disp and abs(x - ans[-1]) != 1:
			disp.remove(x)
			ans.append(x)
			break
	else:
		break
	avance = not avance
if n > 1:
	A = [0, 2]
	disp = set(range(1, n + 1))
	avance = True
	while disp:
		if avance:
			sigs = chain(range(A[-1] + 3, n + 1), [A[-1] + 2])
		else:
			sigs = range(A[-3] + 1, n + 1)
		for x in sigs:
			if x in disp and abs(x - A[-1]) != 1:
				disp.remove(x)
				A.append(x)
				break
		else:
			break
		avance = not avance
	A = A[1:]
if len(ans) < len(A):
	ans = A
if n > 4 and n % 2 == 1 or (n > 3 and n % 2 == 0):
	A = list(range(1, n + 1, 2)) + list(range(2, n + 1, 2))
if len(ans) < len(A):
	ans = A
write(len(ans))
write(' '.join((str(i) for i in ans)))


n = int(input())
x = [i + 1 for i in range(n)]
y = []
z = [1, 3]
if n == 1 or n == 2:
	print(1)
	print(1)
elif n == 3:
	print(2)
	print(*z)
else:
	for i in range(len(x)):
		if x[i] % 2 == 0:
			y.append(x[i])
	for i in range(len(x)):
		if x[i] % 2 != 0:
			y.append(x[i])
	print(len(y))
	print(*y)


n = int(input())
s = [0 for i in range(n)]
t = 1
for i in range(1, n, 2):
	s[i] = t
	t += 1
for i in range(0, n, 2):
	s[i] = t
	t += 1
if n < 3:
	print('1\n1')
elif n == 3:
	print('2\n1 3')
else:
	print(n, ' '.join(map(str, s)), sep='\n')


n = int(input())
if n == 1 or n == 2:
	print(1)
	print(1)
else:
	if n == 3:
		print(n // 2 * 2)
	else:
		print(n)
	x = 1
	y = n
	a = [0]
	for i in range(n // 2):
		a.append(x)
		x += 1
		a.append(y)
		y -= 1
	a[0] += a[n // 2 * 2]
	a.pop(n // 2 * 2)
	if n != 3 and n % 2 != 0:
		a.insert(2, x)
	for i in range(len(a)):
		print(a[i], end=' ')


def main():
	n = int(input())
	x = []
	p = True
	k = n
	l = 1
	for i in range(n):
		if p:
			x.append(l)
			l += 1
		else:
			x.append(k)
			k -= 1
		p ^= True
	if len(x) > 1 and abs(x[-1] - x[-2]) == 1:
		x = [x.pop(-1)] + x
	if len(x) <= 3 and len(x) > 1:
		x = x[1:]
	print(len(x))
	print(' '.join(list(map(str, x))))
main()


n = int(input())
if n == 1 or n == 2:
	print('1\n1')
elif n == 3:
	print('2\n1 3')
elif n == 4:
	print('4\n2 4 1 3')
else:
	ar = [0] * n
	i = 0
	a = 1
	while a <= n:
		ar[i] = a
		i += 1
		a += 2
	a = 2
	while a <= n:
		ar[i] = a
		i += 1
		a += 2
	print(n)
	for i in ar:
		print(i, end=' ')


t = int(input())
arr = []
if t % 2 == 0:
	for i in range(1, t + 1):
		if i % 2 == 0:
			arr.append(i)
	for i in range(1, t + 1):
		if i % 2 == 0 or arr[-1] - 1 == i or arr[-1] + 1 == i:
			continue
		else:
			arr.append(i)
else:
	for i in range(1, t + 1):
		if i % 2 == 1:
			arr.append(i)
	for i in range(1, t + 1):
		if i % 2 == 1 or arr[-1] - 1 == i or arr[-1] + 1 == i:
			continue
		else:
			arr.append(i)
x = arr
print(len(x))
arr = map(str, arr)
print(' '.join(arr))


n = int(input())
if n == 1:
	print(1)
	print(1)
elif n == 2:
	print(1)
	print(1)
elif n == 3:
	print(2)
	print(3, 1)
elif n == 4:
	print(4)
	print(3, 1, 4, 2)
elif n % 4 == 0:
	L = []
	for i in range(1, n // 4 + 1):
		L.append(i * 4 - 1)
		L.append(i * 4 - 3)
		L.append(i * 4)
		L.append(i * 4 - 2)
	print(n)
	for e in L:
		print(e, end=' ')
elif n % 4 == 1:
	L = []
	for i in range(1, n // 4 + 1):
		L.append(i * 4 - 1)
		L.append(i * 4 - 3)
		L.append(i * 4)
		L.append(i * 4 - 2)
	L.append(n)
	print(n)
	for e in L:
		print(e, end=' ')
elif n % 4 == 2:
	L = []
	for i in range(1, n // 4 + 1):
		L.append(i * 4 - 1)
		L.append(i * 4 - 3)
		L.append(i * 4)
		L.append(i * 4 - 2)
	L.insert(0, n - 1)
	L.append(n)
	print(n)
	for e in L:
		print(e, end=' ')
else:
	L = []
	for i in range(1, n // 4 + 1):
		L.append(i * 4 - 1)
		L.append(i * 4 - 3)
		L.append(i * 4)
		L.append(i * 4 - 2)
	L.insert(0, n - 2)
	L.insert(2, n - 1)
	L.append(n)
	print(n)
	for e in L:
		print(e, end=' ')


n = int(input())
answer = []
if n == 4:
	answer = [3, 1, 4, 2]
else:
	for i in range(1, n + 1, 3):
		answer.append(i)
	for i in range(2, n + 1, 3):
		if answer[-1] != i + 1 and answer[-1] != i - 1:
			answer.append(i)
	for i in range(3, n + 1, 3):
		if answer[-1] != i + 1 and answer[-1] != i - 1:
			answer.append(i)
print(len(answer))
print(*answer)


n = int(input())
if n == 1 or n == 2:
	k = 1
	s = '1'
elif n == 3:
	k = 2
	s = '1 3'
elif n == 4:
	k = 4
	s = '3 1 4 2'
else:
	k = n
	i = 1
	s = ''
	if n % 2 == 0:
		j = n // 2 + 1
		while i <= n // 2:
			s += '%s %s ' % (i, j)
			i += 1
			j += 1
	else:
		j = n // 2 + 2
		while i <= n // 2:
			s += '%s %s ' % (i, j)
			i += 1
			j += 1
		s += str(i)
print(k)
print(s)


n = input()
n = int(n)
mylist = []
ans = 0
if n < 3:
	mylist.append(1)
elif n == 3:
	mylist.append(1)
	mylist.append(3)
elif n == 4:
	mylist.append(3)
	mylist.append(1)
	mylist.append(4)
	mylist.append(2)
else:
	for i in range(1, n + 1, 2):
		mylist.append(i)
	for i in range(2, n + 1, 2):
		mylist.append(i)
ans = len(mylist)
print(ans)
for p in mylist:
	print(p, ' ', end='')


n = int(input())
l_o = list()
l_e = list()
for i in range(1, n + 1):
	if i % 2 == 0:
		l_e.append(i)
	else:
		l_o.append(i)
l_e.sort(reverse=True)
l_o.sort(reverse=True)
l_o.extend(l_e)
if n >= 2 and abs(l_o[n - len(l_e)] - l_o[n - len(l_e) - 1]) <= 1:
	l_o.remove(l_o[n - 1])
print(len(l_o))
print(' '.join((str(x) for x in l_o)))


def solve(n):
	if n <= 2:
		return [1]
	if n == 3:
		return [1, 3]
	return [2 * k + 1 for k in reversed(range((n - 1) // 2 + 1))] + [2 * k for k in reversed(range(1, n // 2 + 1))]
n = int(input())
xs = solve(n)
print(len(xs))
print(' '.join((str(x) for x in xs)))


n = int(input())
a = [str(i) for i in range(2, n + 1, 2)] + [str(i) for i in range(1, n + 1, 2)]
if n in [2, 3]:
	a.pop(0)
print(len(a))
print(' '.join(a))


n = int(input(''))
if not 1 <= n <= 5000:
	print('ошибка ввода данных')
	exit(1)
if n == 1 or n == 2:
	answer = [1, '1']
elif n == 3:
	answer = [2, '1 3']
else:
	pupils = list(range(1, n + 1))
	(part_1, part_2) = (pupils[n // 2:], pupils[:n // 2])
	_pupils = [pupils[-1]] if len(pupils) % 2 else []
	for el in list(zip(part_1, part_2)):
		_pupils.extend(el)
	answer = [n, ' '.join(map(str, _pupils))]
[print(el) for el in answer]


n = int(input())
if n == 1:
	print('1')
	print('1')
elif n == 2:
	print('1')
	print('1')
elif n == 3:
	print('2')
	print('1 3')
elif n == 4:
	print('4')
	print('3 1 4 2')
elif n == 5:
	print('5')
	print('3 1 5 2 4')
elif n == 6:
	print('6')
	print('1 5 3 6 2 4')
else:
	arr = [i + 1 for i in range(n)]
	for i in range(n // 2):
		if i % 2 == 0:
			(arr[i], arr[n - i - 1]) = (arr[n - i - 1], arr[i])
	(arr[n // 2], arr[0]) = (arr[0], arr[n // 2])
	print(n)
	print(*arr)


n = int(input())
if n == 1:
	print(1)
	print(1)
elif n == 2:
	print(1)
	print(1)
elif n == 3:
	print(2)
	print(1, 3)
elif n == 4:
	print(4)
	print(3, 1, 4, 2)
elif n > 4:
	A = []
	for i in range(1, n + 1, 2):
		A.append(i)
	for j in range(2, n + 1, 2):
		A.append(j)
	s = ''
	for k in A:
		s = s + str(k) + ' '
	print(n)
	print(s)


n = int(input())
if n < 1:
	res = []
elif n < 3:
	res = [1]
elif n == 3:
	res = [1, 3]
else:
	res = [i for i in range(2, n + 1, 2)] + [i for i in range(1, n + 1, 2)]
print(len(res))
print(' '.join(map(str, res)))


inpp = int(input(''))
if inpp == 1:
	print(1)
	print(1)
elif inpp == 2:
	print(1)
	print(1)
elif inpp == 3:
	print(2)
	print(1, 3)
elif inpp % 2 == 0:
	asd = [i for i in range(2, inpp + 1, 2)]
	asdd = [i for i in range(1, inpp, 2)]
	m = asd + asdd
	print(len(asd + asdd))
	print(' '.join(map(str, m)))
else:
	asdd = [i for i in range(2, inpp + 1, 2)]
	asd = [i for i in range(1, inpp + 1, 2)]
	m = asd + asdd
	print(len(asd + asdd))
	print(' '.join(map(str, m)))


num = int(input())
ans_list = []
n = ''
flag = False
a_list = list(range(1, num + 1, 2))
a_list.reverse()
for i in a_list:
	n = str(i)
	ans_list.append(n)
a_list = list(range(2, num + 1, 2))
a_list.reverse()
for i in a_list:
	if not abs(int(n) - i) == 1:
		flag = True
	if flag == True:
		ans_list.append(str(i))
print(len(ans_list))
print(' '.join(ans_list))


n = int(input())
print((n, n - 1)[(n < 4) - (n == 1)])
print(*(range(n - 1, 0, -2), '')[n - 2 < 2], *range(n, 0, -2))


class Queue:

	def __init__(self):
		self.items = []

	def isEmpty(self):
		return self.items == []

	def enqueue(self, item):
		self.items.insert(0, item)

	def dequeue(self):
		return self.items.pop()

	def size(self):
		return len(self.items)
x = int(input())
if x == 3:
	print('2')
	print('1 3')
	exit()
elif x == 2:
	print('1')
	print('1')
	exit()
st = Queue()
alist = []
c = 0
for i in range(1, x + 1):
	alist.append(i)
m = 0
while c < x:
	st.enqueue(alist[m + x // 2])
	c += 1
	if c < x:
		st.enqueue(alist[m])
		m += 1
		c += 1
print(st.size())
while not st.isEmpty():
	print(st.dequeue(), end=' ')
print('\n')


n = int(input())
a = list(range(1, n + 1))
if n == 1:
	print(1)
	print(1)
	exit(0)
if n == 2 or n == 3:
	print(n - 1)
	del a[-2]
	print(*a)
	exit(0)
if n == 4:
	print(4)
	print(3, 1, 4, 2)
	exit(0)
if n == 5:
	print(5)
	print(5, 3, 1, 4, 2)
	exit(0)
print(n)
for i in range(0, n - 3, 2):
	(a[i], a[i + 3]) = (a[i + 3], a[i])
print(*a)


n = int(input())
if n == 1 or n == 2:
	print('1\n1')
	exit()
if n == 3:
	print('2\n1 3')
	exit()
if n == 4:
	print('4\n3 1 4 2')
	exit()
print(n)
t2 = [[], []]
for i in range(1, n + 1, 2):
	t2[0].append(i)
	if i + 1 <= n:
		t2[1].append(i + 1)
print(*t2[0], *t2[1])


n = int(input())
if n == 1:
	print(1)
	print(1)
	exit()
if n == 2:
	print(1)
	print(1)
	exit()
if n == 3:
	print(2)
	print(1, 3)
	exit()
print(n)
a = list(range(1, n + 1))
ans = []
while a:
	ans.append(a.pop(0))
	if a:
		ans.append(a.pop())
ans.insert(0, ans.pop())
print(' '.join(map(str, ans)))


import sys
n = int(input())
if n == 4:
	print(4)
	print(3, 1, 4, 2)
	sys.exit()
ans = []
for i in range(1, n + 1, 2):
	ans.append(i)
for i in range(2, n + 1, 2):
	if abs(ans[-1] - i) == 1:
		break
	ans.append(i)
print(len(ans))
print(*ans)


n = int(input())
T1 = [str(i) for i in range(1, n + 1) if i % 2 == 1]
T2 = [str(i) for i in range(1, n + 1) if i % 2 == 0]
t = 0
R = T1[::-1] + T2[::-1]
if len(R) == 3:
	print('2')
	print('1 3')
elif len(R) == 2:
	print('1')
	print('1')
else:
	print(len(R))
	print(' '.join(R))


import sys
import os.path
from collections import *
import math
import bisect
if os.path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
else:
	input = sys.stdin.readline
n = int(input())
if n == 2 or n == 1:
	print(1)
	print(1)
elif n == 3:
	print(2)
	print(1, 3)
else:
	print(n)
	for i in range(n - 1, 0, -2):
		print(i, end=' ')
	for i in range(n, 0, -2):
		print(i, end=' ')


import sys
x = int(input())
list = list(range(1, x + 1))
if x == 2:
	print(1)
	print(1)
	sys.exit()
if x == 3:
	print(2)
	print('1 3')
	sys.exit()
print(x)
if x % 2 == 1:
	y = int(x / 2)
	print('{:d} '.format(y + 1), end='')
	for i in range(x, x - y, -1):
		print('{:d} {:d} '.format(i, x + 1 - i), end='')
else:
	y = int(x / 2)
	print('{:d} '.format(y), end='')
	for i in range(x, y + 1, -1):
		print('{:d} {:d} '.format(i, x + 1 - i), end='')
	print(y + 1)


n = int(input())
if n <= 2:
	print(1, 1, sep='\n')
elif n == 3:
	print(2)
	print(1, 3, sep=' ')
elif n == 4:
	print(4)
	print(3, 1, 4, 2, sep=' ')
else:
	print(n)
	ans = []
	for i in range(1, n + 1, 2):
		ans.append(i)
	for i in range(2, n + 1, 2):
		ans.append(i)
	print(*ans, sep=' ')


def main():
	n = int(input())
	a = []
	if n == 4:
		print(4)
		print('2 4 1 3')
		return
	for i in range(0, n, 2):
		a.append(i + 1)
	if a[-1] != 1 and a[-1] != 3:
		for i in range(1, n, 2):
			a.append(i + 1)
	print(len(a))
	for i in range(len(a) - 1):
		print(a[i], end=' ')
	print(a[-1])
main()


n = int(input())

def main():
	if n in [1, 2]:
		print(1)
		print(1)
		return
	elif n == 3:
		print(2)
		print(1, 3)
		return
	elif n == 4:
		print(4)
		print(3, 1, 4, 2)
		return
	print(n)
	for i in range(1, n + 1, 2):
		print(i, end=' ')
	for i in range(2, n + 1, 2):
		print(i, end=' ')
main()


n = int(input())
s = ''
for i in range(1, n + 1, 2):
	s += str(i) + ' '
for i in range(2, n + 1, 2):
	s += str(i) + ' '
if n in [1, 2]:
	print(1)
	print(1)
elif n == 3:
	print(2)
	print(1, 3)
elif n == 4:
	print(4)
	print(3, 1, 4, 2)
else:
	print(n)
	print(s[:len(s) - 1])


n = int(input())
if n == 2 or n == 1:
	print(1)
	print(1)
	exit()
if n == 3:
	print(2)
	print(1, 3)
	exit()
print(n)
if n % 2 == 0:
	if n == 4:
		print(3, 1, 4, 2)
		exit()
	g = n // 2 + 1
	foo = 1
	for i in range(g - 1):
		print(foo, end=' ')
		print(g, end=' ')
		foo += 1
		g += 1
else:
	print(1, end=' ')
	g = n // 2 + 2
	foo = 2
	for i in range(n // 2):
		print(g, end=' ')
		print(foo, end=' ')
		g += 1
		foo += 1


n = int(input())
b = []
for i in range(2, n + 1, 2):
	b.append(i)
for i in range(1, n + 1, 2):
	b.append(i)
for i in range(n - 1):
	if abs(b[i] - b[i + 1]) == 1:
		b.pop(i)
		break
print('%d\n' % len(b) + ' '.join([str(x) for x in b]))


n = int(input())
l = []
for i in range(1, n + 1, 2):
	l.append(i)
l.reverse()
if n > 3:
	for i in range(n - n % 2, 1, -2):
		l.append(i)
print(len(l))
for i in l:
	print(i, end=' ')


n = int(input())
if n == 5:
	print(5)
	print(1, 4, 2, 5, 3)
elif n == 4:
	print(4)
	print(3, 1, 4, 2)
elif n == 3:
	print(2)
	print(1, 3)
elif n == 2 or n == 1:
	print(1)
	print(1)
else:
	l = [i for i in range(1, n + 1, 2)]
	k = [i for i in range(2, n + 1, 2)]
	ans = l + k
	print(n)
	print(*ans)


n = int(input().strip())
if n == 2:
	print(1)
	print(1)
elif n == 3:
	print(2)
	print(1, 3)
elif n == 4:
	print(4)
	print(3, 1, 4, 2)
else:
	arr = [i for i in range(1, n + 1, 2)] + [i for i in range(2, n + 1, 2)]
	print(len(arr))
	print(*arr)


n = int(input())
if n in [1, 2]:
	print(1, 1, sep='\n')
elif n < 4:
	print(2)
	print(1, 3)
elif n % 2 == 0:
	l = list(range(n - 1, 0, -2)) + list(range(n, 1, -2))
	print(len(l))
	print(' '.join(map(str, l)))
else:
	l = list(range(n, 0, -2)) + list(range(n - 1, 1, -2))
	print(len(l))
	print(' '.join(map(str, l)))


n = list(range(1, int(input()) + 1))
if len(n) == 3:
	print(len(n) - 1)
	print(n[0], n[2], sep=' ')
	exit(0)
if len(n) == 2:
	print(len(n) - 1)
	print(n[0])
	exit(0)
l = n[0::2]
m = n[1::2]
print(len(l) + len(m))
print(*reversed(l), *reversed(m), sep=' ')


n = int(input())
a = []
l = 0
for i in range(n // 2):
	a.insert(l, i + 1)
	a.append(n - i)
	l += 2
if n > 1:
	a.insert(0, a[-1])
	del a[-1]
if n % 2 != 0 and n > 3:
	a.insert(n // 2, n // 2 + 1)
if n == 1 or n == 2:
	print(1)
	print(1)
else:
	print(len(a))
	print(*a)


n = int(input())
if n == 1:
	print(1)
	print(1)
if n == 2:
	print(1)
	print(2)
if n == 3:
	print(2)
	print(1, 3)
if n >= 4:
	print(n)
	idx_2 = n // 2
	idx_1 = 0
	while idx_2 < n and idx_1 < n // 2:
		print(idx_2 + 1, idx_1 + 1, end=' ')
		idx_2 += 1
		idx_1 += 1
	if idx_2 < n:
		print(idx_2 + 1)


from math import gcd
n = int(input())
if n <= 2:
	print('1\n1')
elif n == 3:
	print('2\n1 3')
elif n == 4:
	print('4\n2 4 1 3')
elif n == 6:
	print('6\n1 5 3 6 2 4')
elif n > 4:
	for d in range(2, n):
		if gcd(d, n) == 1:
			print(n)
			ans = []
			for i in range(n):
				ans += [d * i % n + 1]
			print(' '.join(map(str, ans)))
			exit(0)


n = int(input())
if n == 1:
	print(1)
	print(1)
	raise SystemExit
if n == 2:
	print(1)
	print(1)
	raise SystemExit
if n == 3:
	print(2)
	print(1, 3)
	raise SystemExit
print(n)
a = [0] * n
a[n - 1] = n
for i in range(n // 2):
	a[2 * i + 1] = i + 1
	a[2 * i] = int(i + 1 + n / 2)
print(' '.join([str(v) for v in a]))


def student(num):
	if num == 2:
		print(1)
		return str(1)
	if num == 3:
		print(2)
		return str(1) + ' ' + str(3)
	odd = [i for i in range(1, num + 1, 2)]
	even = [i for i in range(2, num + 1, 2)]
	srtedo = sorted(odd, reverse=True)
	srtede = sorted(even, reverse=True)
	print(len(even) + len(odd))
	return ' '.join(list(map(str, srtedo + srtede)))
print(student(int(input())))


N = int(input())
if N <= 2:
	print(1)
	print(1)
	exit()
if N == 3:
	print(2)
	print('1 3')
	exit()
ans = [3, 1, 4, 2]
for i in range(4, N):
	if i % 2 == 0:
		ans.append(i + 1)
	else:
		ans = [i + 1] + ans
print(N)
print(' '.join(map(str, ans)))


a = int(input())
if a == 1 or a == 2:
	print(1)
	print(1)
elif a == 3:
	print(2)
	print(1, 3)
elif a == 4:
	print(4)
	print(3, 1, 4, 2)
else:
	i = 0
	b = 1
	print(a)
	while b <= a:
		print(b, end=' ')
		b += 2
	b = 2
	while b <= a:
		print(b, end=' ')
		b += 2


n = int(input())
ans = list(range(1, n + 1, 2))
if n == 4:
	ans = [3, 1, 4, 2]
if n > 4:
	ans += list(range(2, n + 1, 2))
print(len(ans))
print(' '.join(map(str, ans)))


n = int(input())
if n == 1:
	print(n)
	print(n)
else:
	x = [i for i in range(1, n + 1) if i % 2 != 0]
	y = [i for i in range(1, n + 1) if i % 2 == 0]
	x.reverse()
	y.reverse()
	if abs(x[-1] - y[0]) != 1:
		d = x + y
	else:
		d = x
	print(len(d))
	print(*d)


n = int(input())
if n == 2:
	print(1)
	print(1)
elif n == 3:
	print(2)
	print(1, 3)
else:
	a = []
	if n % 2 == 1:
		a.append(n)
		n -= 1
	for i in range(n // 2 - 1, -1, -1):
		a.append(i + 1)
		a.append(i + 1 + n // 2)
	print(len(a))
	print(*a)


n = int(input())
if n <= 2:
	print('1\n1')
elif n == 3:
	print('2\n1 3')
else:
	res = []
	for i in range(0, n):
		if i < n // 2:
			res.append((i + 1) * 2)
		else:
			res.append(2 * (i - n // 2) + 1)
	print(n)
	print(' '.join(map(str, res)))


import math
n = int(input())
if n == 1 or n == 2:
	print(1)
	print(1)
elif n == 3:
	print(2)
	print('1', '3', end=' ')
elif n == 4:
	print(4)
	print('3', '1', '4', '2', end=' ')
else:
	print(n)
	lst = []
	k1 = 1
	k2 = math.ceil(n / 2) + 1
	for j in range(n):
		if j % 2 == 0:
			lst.append(k1)
			k1 += 1
		else:
			lst.append(k2)
			k2 += 1
	for j in range(n):
		print(lst[j], end=' ')


import sys

def alt(end, beg):
	return ' '.join(map(str, range(beg, end + 1, 2)))
num = int(sys.stdin.read())
if num <= 2:
	print('1\n1')
elif num == 3:
	print('2\n1 3')
elif num == 4:
	print('4\n3 1 4 2')
else:
	print(num)
	print(alt(num, 1) + ' ' + alt(num, 2))


import random
n = int(input())
temp = random.randint(2, 3)
if n == 1:
	print(f'{1}\n{1}')
elif n == 2:
	print(f'{1}\n{2}')
elif n == 3:
	print(f'{2}\n{1} {3}')
elif n == 4:
	print(f'{4}\n{3} {1} {4} {2}' if temp % 2 == 0 else f'{4}\n{2} {4} {1} {3}')
else:
	print(n)
	for i in range(1, n + 1, 2):
		print(f'{i} ', end='')
	for i in range(2, n + 1, 2):
		print(f'{i} ', end='')


n = int(input())
if n <= 2:
	print(1)
	print(1)
elif n == 3:
	print(2)
	print(1, 3)
elif n == 4:
	print(4)
	print(2, 4, 1, 3)
else:
	i = 1
	j = n
	l = []
	while i <= j:
		if len(l) % 2 == 0:
			l.append(i)
			i += 1
		else:
			l.append(j)
			j -= 1
	print(len(l))
	t = l[0]
	l[0] = l[n - 1]
	l[n - 1] = t
	print(' '.join(map(str, l)))


a = int(input())
if a == 2 or a == 1:
	print(1)
	print(a)
elif a == 3:
	print(2)
	print(1, 3)
else:
	(o, e) = ([], [])
	for i in range(1, a + 1):
		if i % 2 == 0:
			e.append(i)
		else:
			o.append(i)
	if a % 2 == 0:
		e.reverse()
		o.reverse()
	for i in range(len(e)):
		o.append(e[i])
	print(a)
	for i in range(len(o)):
		print(o[i], end=' ')


n = int(input())
m = []
for i in range(1, n + 1):
	m.append(i)
r1 = []
r2 = []
res = []
if n == 1 or n == 2:
	res.append('1')
elif n == 3:
	res.append('1')
	res.append('3')
elif n % 2 == 0:
	i = 0
	while i < n // 2:
		r1.append(m[i])
		i += 1
	j = n // 2
	while j < n:
		r2.append(m[j])
		j += 1
	for i in range(n // 2):
		res.append(r2[i])
		res.append(r1[i])
else:
	i = 0
	while i < n // 2:
		r1.append(m[i])
		i += 1
	j = n // 2
	while j < n:
		r2.append(m[j])
		j += 1
	for i in range(n // 2):
		res.append(r2[i])
		res.append(r1[i])
	res.append(r2[n // 2])
print(len(res))
res = ' '.join(map(str, res))
print(res)


n = int(input())
if n < 3:
	print(1)
	print(1)
elif n == 3:
	print(2)
	print('1 3')
elif n == 4:
	print(4)
	print('2 4 1 3')
else:
	print(n)
	for i in range(1, n + 1, 2):
		print(i, end=' ', flush=True)
	for i in range(2, n + 1, 2):
		print(i, end=' ', flush=True)


n = int(input())
if 1 <= n < 4:
	k = n
	n -= 1 * (n != 1)
	print(n)
	print(['1', '1', '1 3'][k - 1])
else:
	s = list(range(1, n + 1))
	print(n)
	for i in range(1, n, 2):
		(s[i], s[i - 1]) = (s[i - 1], s[i])
	for i in range(2, n // 2 * 2 - 1, 2):
		(s[i - 1], s[i]) = (s[i], s[i - 1])
	for e in s[:-1]:
		print(e, end=' ')
	print(s[-1])


n = int(input())
t = []
if n == 1 or n == 2:
	print(1)
	print(1)
	quit()
if n == 3:
	print(2)
	print(1, 3)
	quit()
if n % 2 == 0:
	t.append(n // 2 + 1)
	for i in range(1, n // 2):
		t.append(i)
		t.append(n - i + 1)
	t.append(n // 2)
if n % 2 == 1:
	t.append((n + 1) // 2)
	for i in range(1, (n + 1) // 2):
		t.append(i)
		t.append(n - i + 1)
print(n)
print(''.join([str(t[i]) + ' ' for i in range(n)]))


n = int(input())
if n > 3:
	(a, b) = ([], [])
	print(n)
	for i in range(1, n + 1):
		if i % 2 == 0:
			a.append(i)
		else:
			b.append(i)
		a = sorted(a)
		b = sorted(b)
		a = a[::-1]
		b = b[::-1]
	print(*b, *a)
else:
	if n == 3:
		print(2)
		print(1, 3, end=' ')
	if n == 2 or n == 1:
		print(1)
		print(1)


n = int(input())
if n <= 2:
	print(1)
	print(1)
	exit()
if n == 3:
	print(2)
	print(1, 3)
	exit()
print(n)
for i in range(n - 1, 0, -2):
	print(i, end=' ')
for i in range(n, 0, -2):
	print(i, end=' ')


n = int(input())
if n < 3:
	print(1)
	print(1)
elif n == 3:
	print(2)
	print(1, 3)
else:
	print(n)
	arr = list(range(1, n + 1))
	arr = arr[::2][::-1] + arr[1::2][::-1]
	print(*arr)


n = int(input())
if n < 3:
	print('1')
	print('1')
elif n == 3:
	print('2')
	print('1 3')
else:
	print(n)
	if n == 4:
		print('3 1 4 2')
	else:
		x = 1
		s = ''
		while x <= n:
			s += str(x) + ' '
			x += 2
		x = 2
		while x <= n:
			s += str(x) + ' '
			x += 2
		print(s)


n = int(input())
b = ''
for i in range(1, n, 2):
	b += str(i + 1) + ' '
for i in range(0, n, 2):
	b += str(i + 1) + ' '
if n == 1:
	print(1)
	print(1)
elif n == 2:
	print(1)
	print(2)
elif n == 3:
	print(2)
	print(1, 3)
else:
	print(n)
	print(b)


from math import sqrt, pow, ceil
from decimal import *
l1 = int(input())
if l1 <= 2:
	print('1')
	print('1')
elif l1 == 3:
	print('2')
	print('1 3')
elif l1 == 4:
	print('4')
	print('3 1 4 2')
else:
	print(l1)
	for i in range(2, l1 + 1, 2):
		print(str(i) + ' ', end='')
	for i in range(1, l1 + 1, 2):
		print(str(i) + ' ', end='')


import math, sys
from collections import Counter, defaultdict, deque
from sys import stdin, stdout
input = stdin.readline
li = lambda : list(map(int, input().split()))

def case():
	n = int(input())
	a = [0] * n
	if n == 3:
		print(2)
		print(1, 3)
		exit()
	elif n == 2:
		print(1)
		print(1)
		exit()
	print(n)
	j = 1
	for i in range(1, n, 2):
		a[i] = j
		j += 1
	for i in range(0, n, 2):
		a[i] = j
		j += 1
	print(*a)
for _ in range(1):
	case()


n = int(input())
if n < 5:
	if n == 1 or n == 2:
		print('1\n1')
	elif n == 3:
		print('2\n1 3')
	elif n == 4:
		print('4\n2 4 1 3 ')
	exit(0)
print(n)
for i in range(1, int((n + 1) / 2)):
	print(i, i + int((n + 1) / 2), end=' ')
if n % 2 == 1:
	print(int((n + 1) / 2))
else:
	print(int(n / 2), n)


n = int(input())
if n < 3:
	print('1\n1')
elif n == 3:
	print('2\n1 3')
elif n == 4:
	print('4\n3 1 4 2')
else:
	a = [i for i in range(1, n + 1, 2)] + [i for i in range(2, n + 1, 2)]
	print(len(a))
	print(*a)


n = int(input())
if n == 1 or n == 2:
	print(1)
	print(1)
elif n == 3:
	print(2)
	print(1, 3)
else:
	l = [i for i in range(2, n + 1, 2)] + [i for i in range(1, n + 1, 2)]
	print(n)
	print(*l)


n = int(input())
if n < 3:
	print(1)
	print(1)
elif n == 3:
	print(2)
	print('1 3')
elif n == 4:
	print(4)
	print('3 1 4 2')
else:
	print(n)
	line_0 = list()
	line_1 = list()
	turn = True
	for i in range(1, n + 1):
		if turn:
			line_0.append(str(i))
		else:
			line_1.append(str(i))
		turn = not turn
	print(' '.join(line_0) + ' ' + ' '.join(line_1))


n = int(input())
if n == 1 or n == 2:
	print('1')
	print('1')
elif n == 3:
	print('2')
	print('1 3')
else:
	print(n)
	resp = []
	for i in range(2, n + 1, 2):
		resp.append(str(i))
	for i in range(1, n + 1, 2):
		resp.append(str(i))
	resp = ' '.join(resp)
	print(resp)


n = int(input())
res = ([], [i for i in range(2, n + 1, 2)])[n > 3] + [i for i in range(1, n + 1, 2)]
print(len(res))
print(' '.join(map(str, res)))


i = int(input())
if i <= 2:
	print(1)
	print(1)
elif i == 3:
	print(2)
	print('1 3')
elif i > 3:
	impar = ''
	par = ''
	for x in range(1, i + 1):
		if x % 2 == 0:
			par += str(x) + ' '
		else:
			impar += str(x) + ' '
	print(i)
	print(par[:-1], impar[:-1])


n = int(input())
l = []
m = []
if n == 1:
	print(1)
	print(1)
elif n == 2:
	print(1)
	print(1)
elif n == 3:
	print(2)
	print(1, 3)
else:
	print(n)
	for i in range(1, n + 1):
		if i % 2 == 0:
			l.append(i)
		else:
			m.append(i)
	p = l + m
	for r in p:
		print(r, end=' ')


n = int(input())
s = ''
if n == 1:
	print(1)
	print(1)
	exit()
if n == 2:
	print(1)
	print(2)
	exit()
if n == 3:
	print(2)
	print('1 3')
	exit()
if n == 4:
	print(4)
	print('3 1 4 2')
	exit()
if n % 2 == 1:
	i = n
	while i > 0:
		symbol = str(i)
		s += symbol + ' '
		i -= 2
	i = n - 1
	while i >= 1:
		symbol = str(i)
		s += symbol + ' '
		i -= 2
if n % 2 == 0:
	i = n - 1
	while i >= 1:
		symbol = str(i)
		s += symbol + ' '
		i -= 2
	i = n
	while i > 0:
		symbol = str(i)
		s += symbol + ' '
		i -= 2
print(n)
print(s[0:len(s) - 1])


n = int(input())
L = []
for i in range(1, n + 1):
	L.append(i)
if n == 1 or n == 2:
	print('1')
	print('1')
elif n == 3:
	print('2')
	print('1' + ' ' + '3')
elif n == 4:
	print('4')
	print('3' + ' ' + '1' + ' ' + '4' + ' ' + '2')
else:
	odd = []
	even = []
	for i in L:
		if i & 1:
			odd.append(i)
		else:
			even.append(i)
	nums = odd + even
	print(len(nums))
	print(' '.join(map(str, nums)))


n = int(input())
res = ''
num = n
odd = [int(i) for i in range(1, n + 1, 2)]
even = [int(j) for j in range(2, n + 1, 2)]
mylist = odd[::-1] + even[::-1]
if n == 1 or n == 2:
	num = 1
	res = '1'
elif n == 3:
	num = 2
	res = '1 3'
else:
	for i in mylist:
		res += str(i) + ' '
print(num)
print(res)


n = int(input())
if n <= 2:
	print(1)
	print(1)
if n == 3:
	print(2)
	print(1, 3)
if n == 4:
	print(4)
	print(3, 1, 4, 2)
if n > 4:
	print(n)
	i = 1
	while i <= n:
		print(i, end=' ')
		i = i + 2
	i = 2
	while i <= n:
		print(i, end=' ')
		i = i + 2


n = int(input())
if n <= 2:
	print('1\n1')
elif n == 3:
	print('2\n1 3')
else:
	w = ''
	for r in range(2, n + 1, 2):
		w = w + str(r) + ' '
	for r in range(1, n + 1, 2):
		w = w + str(r) + ' '
	print(n)
	print(w)


x = int(input())
array = []
a = []
b = []
for i in range(1, x + 1):
	array.append(i)
	if i % 2 == 0:
		a.append(i)
	else:
		b.append(i)
if i == 2:
	print(1)
	print(1)
elif i == 3:
	print(2)
	print(1, 3)
else:
	print(len(a + b))
	for y in a + b:
		print(y, end=' ')


n = int(input())
if n == 1 or n == 2:
	print(1)
	print(1)
elif n == 3:
	print(2)
	print(1, 3)
elif n == 4:
	print(4)
	print(3, 1, 4, 2)
else:
	k = 1
	print(n)
	for x in range(n):
		print(k, end=' ')
		k += 2
		if k > n:
			k = 2


n = int(input())
if n <= 3:
	if n <= 2:
		print(1)
		print(1)
	else:
		print(2)
		print(1, 3)
else:
	print(n)
	for j in range(1, n + 1):
		if j % 2 == 0:
			print(j, end=' ')
	for k in range(1, n + 1):
		if k % 2:
			print(k, end=' ')


n = int(input())
if 1 <= n <= 2:
	print(1, '\n1')
elif n == 3:
	print(2, '\n1 3')
elif n == 4:
	print(4, '\n3 1 4 2')
else:
	print(n)
	print(' '.join(map(str, list(range(1, n + 1, 2)) + list(range(2, n + 1, 2)))))


n = int(input().strip())
if n == 4:
	print(4)
	print('3 1 4 2')
else:
	otvet = ''
	for i in range(1, n + 1, 2):
		otvet = otvet + str(i) + ' '
	if n in [3, 2]:
		print(len(otvet) // 2)
		print(otvet)
	else:
		for i in range(2, n + 1, 2):
			otvet = otvet + str(i) + ' '
		print(n)
		print(otvet)


def student(num):
	if num == 2:
		print(1)
		return str(1)
	if num == 3:
		print(2)
		return str(1) + ' ' + str(3)
	odd = [i for i in range(1, num + 1, 2)]
	even = [i for i in range(2, num + 1, 2)]
	print(len(even) + len(odd))
	return ' '.join(list(map(str, odd[::-1] + even[::-1])))
print(student(int(input())))


n = int(input())
a = []
a_new = []
for k in range(1, n + 1):
	a.append(k)
if n == 1:
	a_new.append(1)
elif n == 2:
	a_new.append(2)
elif n == 3:
	a_new.append(1)
	a_new.append(3)
elif n == 4:
	a_new.append(3)
	a_new.append(1)
	a_new.append(4)
	a_new.append(2)
else:
	for i in range(n):
		if a[i] % 2 != 0:
			a_new.append(a[i])
	for m in range(n):
		if a[m] % 2 == 0:
			a_new.append(a[m])
print(len(a_new))
print(*a_new)


n = int(input())
if n >= 5:
	l = [i for i in range(1, n + 1, 2)]
	l.extend([i for i in range(2, n + 1, 2)])
	print(n, sep='\n')
	print(*l)
elif n == 4:
	print(4)
	print(*[3, 1, 4, 2])
elif n == 3:
	print(2)
	print(*[1, 3])
else:
	print(1)
	print(1)


x = int(input())
if x > 3:
	print(x)
	if x % 2 == 1:
		for i in range(x, 0, -2):
			print(i, end=' ')
		for j in range(x - 1, 0, -2):
			print(j, end=' ')
	else:
		for j in range(x - 1, 0, -2):
			print(j, end=' ')
		for i in range(x, 0, -2):
			print(i, end=' ')
if x <= 3:
	if x == 3:
		print(2)
		print(1, 3)
	elif x == 2:
		print(1)
		print(1)
	else:
		print(1)
		print(1)


n = int(input())
if n == 1:
	print(1)
	print(n)
elif n == 2:
	print(1)
	print(1)
elif n == 3:
	print(2)
	print(1, 3)
elif n == 4:
	print(4)
	print(3, 1, 4, 2)
else:
	i = 1
	m = n
	l = []
	while i < m:
		l.append(i)
		l.append(m)
		i = i + 1
		m = m - 1
	if n % 2 != 0:
		l.append(int(n // 2) + 1)
	print(len(l))
	(l[0], l[n - 1]) = (l[n - 1], l[0])
	print(*l)


n = int(input())
odd = []
even = []
for i in range(1, n + 1):
	if i % 2 == 0:
		even.append(i)
	else:
		odd.append(i)
even.sort()
odd.sort()
if n == 3:
	print(n - 1)
	print('1 3')
elif n > 3:
	print(n)
	print(*odd[::-1], *even[::-1])
elif n == 1:
	print(n)
	print(n)
elif n == 2:
	print(1)
	print(1)


n = int(input())
if n != 4:
	counter = 0
	ant_i = 0
	i = 1
	ans = ''
	while i <= n:
		ant_i = i
		ans += str(i) + ' '
		counter += 1
		i += 2
	j = 2
	while ant_i != j - 1 and ant_i != j + 1 and (j <= n):
		ant_i = j
		ans += str(j) + ' '
		counter += 1
		j += 2
	print(counter)
	print(ans)
else:
	print(4)
	print('2 4 1 3')


x = int(input())
array = []
j = []
k = []
for i in range(1, x + 1):
	array.append(i)
	if i % 2 == 0:
		j.append(i)
	else:
		k.append(i)
if i == 3:
	print(2)
	print(1, 3)
elif i == 2:
	print(1)
	print(1)
else:
	print(len(j + k))
	for y in j + k:
		print(y, end=' ')


n = int(input())
if n == 2:
	print(1)
	print(1)
elif n == 3:
	print(2)
	print('1 3')
else:
	a = list(range(n - (1 - n % 2), 0, -2)) + list(range(2 * (n // 2), 1, -2))
	print(len(a))
	print(' '.join(map(str, a)))


n = int(input())
if n == 3:
	print('2')
	print('1 3')
if n <= 2:
	print('1')
	print('1')
if n >= 4:
	print(n)
	l = list(range(1, n + 1))
	l.sort()
	l.reverse()
	for i in l:
		if i % 2 != 0:
			print(i, end=' ')
	for i in l:
		if i % 2 == 0:
			print(i, end=' ')


import math
import string

def main():
	n = int(input())
	if n <= 2:
		ans = [1]
	elif n == 3:
		ans = [1, 3]
	else:
		ans = list(range(2, n + 1, 2)) + list(range(1, n + 1, 2))
	print(len(ans))
	print(' '.join(map(str, ans)))
main()


n = int(input())
if n <= 2:
	m = 1
	order = [1]
elif n == 3:
	m = 2
	order = [1, 3]
elif n == 4:
	m = 4
	order = [3, 1, 4, 2]
elif n % 2 == 0:
	m = n
	order = list(range(1, n, 2)) + list(range(2, n + 1, 2))
else:
	m = n
	order = list(range(1, n + 1, 2)) + list(range(2, n, 2))
print(m)
print(' '.join([str(i) for i in order]))


a = int(input())
if a > 5:
	print(a)
	index = a % 2
	b = int(a / 2)
	for i in range(b):
		print(i + 1 + index, end=' ')
		print(i + 1 + b + index, end=' ')
	if index == 1:
		print('1')
else:
	if a == 1 or a == 2:
		print('1')
		print('1')
	if a == 3:
		print('2')
		print('1 3')
	if a == 4:
		print('4')
		print('2 4 1 3')
	if a == 5:
		print('5')
		print('1 3 5 2 4')


import sys
import math
import bisect

def solve(n):
	A = []
	for i in range(n, 0, -1):
		if i % 2 == 1:
			A.append(i)
	for i in range(n, 0, -1):
		if i % 2 == 0:
			if abs(A[-1] - i) != 1:
				A.append(i)
	return A

def main():
	n = int(input())
	A = solve(n)
	print(len(A))
	print(' '.join(list((str(a) for a in A))))
main()


n = int(input())
students = [0] * 10010
mini = 4998
maxi = 5003
i = 5
j = 0
if n == 1:
	print(1)
	print(1)
elif n == 2:
	print(1)
	print(1)
elif n == 3:
	print(2)
	print(1, 3)
else:
	students[4999] = 3
	students[5000] = 1
	students[5001] = 4
	students[5002] = 2
	while n >= i:
		if j == 0:
			j = 1
			students[mini] = i
			mini -= 1
		else:
			j = 0
			students[maxi] = i
			maxi += 1
		i += 1
	print(n)
	j = 0
	for z in range(2000, 9000):
		if students[z] != 0 and j == 0:
			print(students[z], end=' ')


n = int(input())
l = []
b = []
for i in range(1, n + 1, 2):
	l.append(i)
for i in range(2, n + 1, 2):
	if abs(l[-1] - i) != 1:
		l.append(i)
	elif abs(l[0] - i) != 1:
		l.insert(0, i)
	else:
		b.append(i)
for i in range(len(b)):
	if abs(l[0] - b[i]) != 1:
		l.insert(0, b[i])
	elif abs(l[-1] - b[i]) != 1:
		l.insert(-1, b[i])
print(len(l))
for i in range(len(l)):
	print(l[i], end=' ')


n = int(input())
p = []
l = []
if n == 1:
	print(1)
	print(1)
elif n == 2:
	print(1)
	print(1)
elif n == 3:
	print(2)
	print(1, 3)
else:
	for i in range(1, n + 1):
		if i % 2 == 0:
			p.append(i)
		else:
			l.append(i)
	o = p + l
	print(len(o))
	for j in o:
		print(j, end=' ')


n = int(input())
if n > 1 and n < 4:
	print(n - 1)
	if n == 2:
		print('1')
	if n == 3:
		print('1 3')
	if n == 4:
		print('4 1 3')
else:
	print(n)
	i = 2
	l = []
	while i <= n:
		l.append(i)
		i += 2
	i = 1
	while i <= n:
		l.append(i)
		i += 2
	for i in range(n - 1):
		print(l[i], ' ', end='')
	print(l[-1])


n = int(input())
if n == 1:
	print(1)
	print(1)
elif n == 2:
	print(1)
	print(1)
elif n == 2:
	print(1)
	print(1)
elif n == 3:
	print(2)
	print(1, 3)
elif n == 4:
	print(4)
	print(3, 1, 4, 2)
else:
	ev = (1,)
	od = 1
	print(n)
	for i in range(1, 3):
		f = i
		while f <= n:
			print(f, end=' ')
			f += 2


n = int(input())
if n > 3:
	print(n)
	s = []
	for i in range(1, n + 1):
		if i % 2 == 0:
			s.append(i)
	for i in range(1, n + 1):
		if i % 2:
			s.append(i)
	print(*s)
if n == 3:
	print(2)
	print(1, 3)
if n == 2:
	print(1)
	print(1)
if n == 1:
	print(1)
	print(1)


n = int(input())
if n == 1 or n == 2:
	print(1)
	print(1)
elif n == 3:
	print(2)
	print(1, 3)
elif n == 4:
	print(4)
	print(2, 4, 1, 3)
else:
	print(n)
	i = 1
	while i <= n:
		print(i, end=' ')
		i += 2
	i = 2
	while i <= n:
		print(i, end=' ')
		i += 2


num = int(input())
if num == 3:
	print('2')
	print('1 3')
elif num == 2 or num == 1:
	print('1')
	print('1')
elif num == 4:
	print('4')
	print('3 1 4 2')
else:
	all = [x for x in range(1, num + 1, 2)] + [x for x in range(2, num + 1, 2)]
	print(len(all))
	print(str(all).replace('[', '').replace(',', '').replace(']', ''))


def fill_arr(n):
	return [int(x) for x in range(1, n + 1)]

def print_arr(arr):
	print(*arr, sep=' ', end=' ')
n = int(input())
a = fill_arr(n)
if n < 4:
	print(len(a[::2]))
	print_arr(a[::2])
else:
	print(n)
	print_arr(a[n - 2::-2])
	print_arr(a[n - 1::-2])


n = int(input())
a = []
if n == 1 or n == 2:
	print(1)
	print(1)
elif n == 3:
	print(2)
	print(1, 3)
elif n == 4:
	print(4)
	print(3, 1, 4, 2)
else:
	if n % 2 != 0:
		ind1 = n // 2 + 2
	else:
		ind1 = n // 2 + 1
	ind2 = 1
	for i in range(n):
		if i % 2 == 0:
			a.append(ind2)
			ind2 += 1
		else:
			a.append(ind1)
			ind1 += 1
	print(n)
	print(*a)


l = [None, '1\n1', '1\n1', '2\n1 3', '4\n2 4 1 3']
n = int(input())
if n in range(len(l)):
	print(l[n])
else:
	print(n)
	print(' '.join(map(str, range(1, n + 1, 2))), end=' ')
	print(' '.join(map(str, range(2, n + 1, 2))))


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return [int(x) for x in sys.stdin.readline().split()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def main():
	n = I()
	r = list(range(1, n + 1, 2))[::-1]
	if n > 3:
		r += list(range(2, n + 1, 2))[::-1]
	return '{}\n{}'.format(len(r), ' '.join(map(str, r)))
print(main())