#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int n;
  scanf("%d", &n);
  if (n <= 2) {
    printf("%d\n", 1);
    printf("%d\n", 1);
  } else if (n == 3) {
    printf("%d\n", 2);
    printf("%d %d\n", 1, 3);
  } else if (n == 4) {
    printf("%d\n", 4);
    printf("%d %d %d %d\n", 2, 4, 1, 3);
  } else if (n >= 5) {
    printf("%d\n", n);
    int i;
    for (i = 1; i <= n; i += 2) {
      printf("%d\n", i);
    }
    for (i = 2; i <= n; i += 2) {
      printf("%d\n", i);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x2,-0x8(%rbp)
jg     1174 <main+0x54>
lea    0xebc(%rip),%rdi
mov    $0x1,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xea9(%rip),%rdi
mov    $0x1,%esi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1286 <main+0x166>
cmpl   $0x3,-0x8(%rbp)
jne    11ae <main+0x8e>
lea    0xe87(%rip),%rdi
mov    $0x2,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe71(%rip),%rdi
mov    $0x1,%esi
mov    $0x3,%edx
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1281 <main+0x161>
cmpl   $0x4,-0x8(%rbp)
jne    11f3 <main+0xd3>
lea    0xe4d(%rip),%rdi
mov    $0x4,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe31(%rip),%rdi
mov    $0x2,%esi
mov    $0x4,%edx
mov    $0x1,%ecx
mov    $0x3,%r8d
mov    $0x0,%al
call   1030 <printf@plt>
jmp    127c <main+0x15c>
cmpl   $0x5,-0x8(%rbp)
jl     1277 <main+0x157>
mov    -0x8(%rbp),%esi
lea    0xe05(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     1240 <main+0x120>
mov    -0xc(%rbp),%esi
lea    0xde1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0xc(%rbp)
jmp    1215 <main+0xf5>
movl   $0x2,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     1272 <main+0x152>
mov    -0xc(%rbp),%esi
lea    0xdaf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0xc(%rbp)
jmp    1247 <main+0x127>
jmp    1277 <main+0x157>
jmp    127c <main+0x15c>
jmp    1281 <main+0x161>
jmp    1286 <main+0x166>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xed5(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%esi
cmp    $0x2,%esi
jg     1168 <main+0x48>
lea    0xec7(%rip),%rbx
mov    %rbx,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    1235 <main+0x115>
lea    0xe9d(%rip),%rdi
cmp    $0x4,%esi
je     11a2 <main+0x82>
cmp    $0x3,%esi
jne    11d3 <main+0xb3>
mov    $0x2,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe7d(%rip),%rdi
mov    $0x1,%esi
mov    $0x3,%edx
xor    %eax,%eax
call   1030 <printf@plt>
jmp    1235 <main+0x115>
mov    $0x4,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe4e(%rip),%rdi
mov    $0x2,%esi
mov    $0x4,%edx
mov    $0x1,%ecx
mov    $0x3,%r8d
xor    %eax,%eax
call   1030 <printf@plt>
jmp    1235 <main+0x115>
xor    %eax,%eax
call   1030 <printf@plt>
cmpl   $0x0,0x4(%rsp)
jle    1235 <main+0x115>
mov    $0x1,%ebx
lea    0xe1f(%rip),%r14
nopl   (%rax)
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x2,%ebx
mov    0x4(%rsp),%eax
cmp    %eax,%ebx
jle    11f0 <main+0xd0>
cmp    $0x2,%eax
jl     1235 <main+0x115>
mov    $0x2,%ebx
lea    0xdf4(%rip),%r14
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x2,%ebx
cmp    0x4(%rsp),%ebx
jle    1220 <main+0x100>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%d\0A\00"
@.str.2 = [7 x i8] c"%d %d\0A\00"
@.str.3 = [13 x i8] c"%d %d %d %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%5 = load i32, i32* %2
%6 = icmp sle i32 %5, 2
br i1 %6, label %7, label %10
7: ; preds = %0
%8 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 1)
%9 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 1)
br label %53
10: ; preds = %0
%11 = load i32, i32* %2
%12 = icmp eq i32 %11, 3
br i1 %12, label %13, label %16
13: ; preds = %10
%14 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 2)
%15 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32 1, i32 3)
br label %52
16: ; preds = %10
%17 = load i32, i32* %2
%18 = icmp eq i32 %17, 4
br i1 %18, label %19, label %22
19: ; preds = %16
%20 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 4)
%21 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i32 2, i32 4, i32 1, i32 3)
br label %51
22: ; preds = %16
%23 = load i32, i32* %2
%24 = icmp sge i32 %23, 5
br i1 %24, label %25, label %50
25: ; preds = %22
%26 = load i32, i32* %2
%27 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %26)
store i32 1, i32* %3
br label %28
28: ; preds = %35, %25
%29 = load i32, i32* %3
%30 = load i32, i32* %2
%31 = icmp sle i32 %29, %30
br i1 %31, label %32, label %38
32: ; preds = %28
%33 = load i32, i32* %3
%34 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %33)
br label %35
35: ; preds = %32
%36 = load i32, i32* %3
%37 = add nsw i32 %36, 2
store i32 %37, i32* %3
br label %28
38: ; preds = %28
store i32 2, i32* %3
br label %39
39: ; preds = %46, %38
%40 = load i32, i32* %3
%41 = load i32, i32* %2
%42 = icmp sle i32 %40, %41
br i1 %42, label %43, label %49
43: ; preds = %39
%44 = load i32, i32* %3
%45 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %44)
br label %46
46: ; preds = %43
%47 = load i32, i32* %3
%48 = add nsw i32 %47, 2
store i32 %48, i32* %3
br label %39
49: ; preds = %39
br label %50
50: ; preds = %49, %22
br label %51
51: ; preds = %50, %19
br label %52
52: ; preds = %51, %13
br label %53
53: ; preds = %52, %7
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%d\0A\00"
@.str.2 = [7 x i8] c"%d %d\0A\00"
@.str.3 = [13 x i8] c"%d %d %d %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = icmp slt i32 %4, 3
br i1 %5, label %6, label %9
6: ; preds = %0
%7 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 1)
%8 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 1)
br label %34
9: ; preds = %0
switch i32 %4, label %16 [
i32 3, label %10
i32 4, label %13
]
10: ; preds = %9
%11 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 2)
%12 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32 1, i32 3)
br label %34
13: ; preds = %9
%14 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 4)
%15 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i32 2, i32 4, i32 1, i32 3)
br label %34
16: ; preds = %9
%17 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %4)
%18 = load i32, i32* %1
%19 = icmp slt i32 %18, 1
br i1 %19, label %34, label %22
20: ; preds = %22
%21 = icmp slt i32 %26, 2
br i1 %21, label %34, label %28
22: ; preds = %16, %22
%23 = phi i32 [ %25, %22 ], [ 1, %16 ]
%24 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %23)
%25 = add nuw nsw i32 %23, 2
%26 = load i32, i32* %1
%27 = icmp sgt i32 %25, %26
br i1 %27, label %20, label %22
28: ; preds = %20, %28
%29 = phi i32 [ %31, %28 ], [ 2, %20 ]
%30 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %29)
%31 = add nuw nsw i32 %29, 2
%32 = load i32, i32* %1
%33 = icmp sgt i32 %31, %32
br i1 %33, label %34, label %28
34: ; preds = %28, %16, %20, %10, %13, %6
ret i32 0
}