from itertools import combinations

n=int(eval(input()))

A,B=[i+1 for i in range(n)],[]

num=n if n%2==1 else n+1

for a,b in combinations(A,2):

    if a+b!=num:B.append([a,b])

print((len(B)))

for i in B:print((*i))
from itertools import combinations

n=int(eval(input()))

A=[]

num=n if n%2==1 else n+1

for a,b in combinations([j+1 for j in range(n)],2):

    if a+b!=num:A.append([a,b])

print((len(A)))

for i in A:print((*i))
from itertools import combinations

n = int(eval(input()))
A, B = [i + 1 for i in range(n)], []
num = n if n % 2 == 1 else n + 1
for a, b in combinations(A, 2):
    if a + b != num:
        B.append([a, b])
print((len(B)))
for i in B:
    print((*i))

from itertools import combinations

n = int(eval(input()))
A = []
num = n if n % 2 == 1 else n + 1
for a, b in combinations([j + 1 for j in range(n)], 2):
    if a + b != num:
        A.append([a, b])
print((len(A)))
for i in A:
    print((*i))

-A, B = [i + 1 for i in range(n)], [] +A = [] -for a, b in combinations(A, 2): +for a, b in combinations([j + 1 for j in range(n)], 2): -        B.append([a, b]) -print((len(B))) -for i in B: +        A.append([a, b]) +print((len(A))) +for i in A: