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

Difficulty: interview

Starter code:

Solutions:
n = int(input())
if n >= 5:
    print(n)
    for i in range(1, n + 1, 2):
        print(i, end = ' ')
    for i in range(2, n + 1, 2):
        print(i, end = ' ')
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==1:
    print(1)
    print(1)
elif x == 2:
    print(1)
    print(1)
elif x == 3:
    print(2)
    print(1, 3)
else:
    if 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 == 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())
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().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)))

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)


#!/usr/bin/env python

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 == 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):
        if abs(a[-1] - i) > 1:
            a.append(i)

    print(len(a))
    print(" ".join(map(str, 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))))


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

elif n == 1 or n == 2:
	print('1')
	print('1')
elif n == 3:
	print('2')
	print('1 3')
else:
	print('4')
	print('3 1 4 2')


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())
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=" ")
            


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)


import sys
from math import *
#sys.stdin = open('inpA.in', 'r')

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 = 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 = 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)


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])
def __starting_point():
    main()

__starting_point()

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)
elif n%2==0:
    print(n)
    for i in range(1, n//2 + 1):
        print(i, end = " ")
        print(n//2 + i, end = " ")
else:
    print(n)
    for i in range(1, n//2 + 1):
        print(i, end = " ")
        print(n//2 + i + 1, end = " ")
    print(n//2 + 1)


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("]", ""))

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())
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))))


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])
else:
    if 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')

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)

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)
	l=[]
	m=0
	for i in range(1,((n+1)//2)+1):
		l.append(str(i))
		m=i
	for i in range(n//2):
		l.insert(2*i+1, str(m+i+1))
	print(' '.join(l))