N = int(eval(input()))



c = 0

ANS = []



for i in range(N):

    for j in range(i+1, N):

        if i+j+2 != (N if N % 2 else N+1):

            c += 1

            ANS.append((i+1, j+1))



print(c)

for ans in ANS:

    print((*ans))
N = int(eval(input()))

if N & 1:

    print(((N-1)**2//2))

    for i in range(N):

        for j in range(i+1, N):

            if i + j == N - 2 and j < N - 1: continue

            print((i+1, j+1))

else:

    print((N*N//2-N))

    for i in range(N):

        for j in range(i+1, N):

            if i + j == N - 1: continue

            print((i+1, j+1))

N = int(eval(input()))
c = 0
ANS = []
for i in range(N):
    for j in range(i + 1, N):
        if i + j + 2 != (N if N % 2 else N + 1):
            c += 1
            ANS.append((i + 1, j + 1))
print(c)
for ans in ANS:
    print((*ans))

N = int(eval(input()))
if N & 1:
    print(((N - 1) ** 2 // 2))
    for i in range(N):
        for j in range(i + 1, N):
            if i + j == N - 2 and j < N - 1:
                continue
            print((i + 1, j + 1))
else:
    print((N * N // 2 - N))
    for i in range(N):
        for j in range(i + 1, N):
            if i + j == N - 1:
                continue
            print((i + 1, j + 1))

-c = 0 -ANS = [] -for i in range(N): -    for j in range(i + 1, N): -        if i + j + 2 != (N if N % 2 else N + 1): -            c += 1 -            ANS.append((i + 1, j + 1)) -print(c) -for ans in ANS: -    print((*ans)) +if N & 1: +    print(((N - 1) ** 2 // 2)) +    for i in range(N): +        for j in range(i + 1, N): +            if i + j == N - 2 and j < N - 1: +                continue +            print((i + 1, j + 1)) +else: +    print((N * N // 2 - N)) +    for i in range(N): +        for j in range(i + 1, N): +            if i + j == N - 1: +                continue +            print((i + 1, j + 1))