from math import factorial



n=int(input())



print(factorial(n)//factorial(n-2)//2-n//2)



m = (n//2)*2

for i in range(1,n+1):

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

        if i+j != m+1:

            print(i,end=' ')

            print(j)

n = int(eval(input()))

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



m = n//2*2+1

for i in range(1,n):

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

        if i+j!=m:

            print((i,j))
from math import factorial

n = int(input())
print(factorial(n) // factorial(n - 2) // 2 - n // 2)
m = (n // 2) * 2
for i in range(1, n + 1):
    for j in range(i + 1, n + 1):
        if i + j != m + 1:
            print(i, end=" ")
            print(j)

n = int(eval(input()))
print((n * (n - 1) // 2 - n // 2))
m = n // 2 * 2 + 1
for i in range(1, n):
    for j in range(i + 1, n + 1):
        if i + j != m:
            print((i, j))

-from math import factorial - -n = int(input()) -print(factorial(n) // factorial(n - 2) // 2 - n // 2) -m = (n // 2) * 2 -for i in range(1, n + 1): +n = int(eval(input())) +print((n * (n - 1) // 2 - n // 2)) +m = n // 2 * 2 + 1 +for i in range(1, n): -        if i + j != m + 1: -            print(i, end=" ") -            print(j) +        if i + j != m: +            print((i, j))