import sys

sys.setrecursionlimit(10**9)

input = sys.stdin.readline



N = int(eval(input()))

edges = []

if N % 2 == 0:

    D = N+1

else:

    D = N

for i in range(1, D):

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

        if i+j == D:

            continue

        else:

            edges.append(str(i)+" "+str(j))

if N % 2 == 1:

    for v in range(1, N):

        edges.append(str(v)+" "+str(N))

print((len(edges)))

for e in edges:

    print(e)

N = int(eval(input()))

D = N if N % 2 == 1 else N+1

edges = [str(i)+" "+str(j) for i in range(1, D)

         for j in range(i+1, D) if i+j != D]

edges2 = [str(v)+" "+str(N) for v in range(1, N)] if N % 2 == 1 else []

print((len(edges)+len(edges2)))

print(("\n".join(edges+edges2)))

import sys

sys.setrecursionlimit(10**9)
input = sys.stdin.readline
N = int(eval(input()))
edges = []
if N % 2 == 0:
    D = N + 1
else:
    D = N
for i in range(1, D):
    for j in range(i + 1, D):
        if i + j == D:
            continue
        else:
            edges.append(str(i) + " " + str(j))
if N % 2 == 1:
    for v in range(1, N):
        edges.append(str(v) + " " + str(N))
print((len(edges)))
for e in edges:
    print(e)

N = int(eval(input()))
D = N if N % 2 == 1 else N + 1
edges = [
    str(i) + " " + str(j) for i in range(1, D) for j in range(i + 1, D) if i + j != D
]
edges2 = [str(v) + " " + str(N) for v in range(1, N)] if N % 2 == 1 else []
print((len(edges) + len(edges2)))
print(("\n".join(edges + edges2)))

-import sys - -sys.setrecursionlimit(10**9) -input = sys.stdin.readline -edges = [] -if N % 2 == 0: -    D = N + 1 -else: -    D = N -for i in range(1, D): -    for j in range(i + 1, D): -        if i + j == D: -            continue -        else: -            edges.append(str(i) + " " + str(j)) -if N % 2 == 1: -    for v in range(1, N): -        edges.append(str(v) + " " + str(N)) -print((len(edges))) -for e in edges: -    print(e) +D = N if N % 2 == 1 else N + 1 +edges = [ +    str(i) + " " + str(j) for i in range(1, D) for j in range(i + 1, D) if i + j != D +] +edges2 = [str(v) + " " + str(N) for v in range(1, N)] if N % 2 == 1 else [] +print((len(edges) + len(edges2))) +print(("\n".join(edges + edges2)))