# Arup Guha
# 12/9/2025
# Solution to 2025 UCF HS Online D1 Problem E: Machine

# Get input.
n = int(input())

# Make sure we don't mess up for n=1.
for i in range(min(n,2)):
    print(2*i,0)

# Just building lots of triangles.
# Each vertex adds 3 edges...
for i in range(2,n):
    print(1,i-1)

# Special cases.
if n == 1:
    print(0)
elif n == 2:
    print(1)
    print("1 2")

# Here is my triangle design.
else:
    print(3*(n-2))

    print("1 2")
    print("1 3")
    print("2 3")

    # Vertex i, one based is the one we're adding.
    for i in range(4,n+1):

        # This is link straight down.
        print(i,i-1)

        # These go to the bottom...
        print(i,1)
        print(i,2)
