You are given an integer N. Build an undirected graph with N vertices with indices 1 to N that satisfies the following two conditions:    * The graph is simple and connected.   * There exists an integer S such that, for every vertex, the sum of the indices of the vertices adjacent to that vertex is S.  It can be proved that at least one such graph exists under the constraints of this problem.
import sys
input = sys.stdin.readline

n = int(input())
if n == 3:
    print(2)
    print(1,3)
    print(3,2)
    exit()
if n == 4:
    print(4)
    print(1,2)
    print(2,4)
    print(4,3)
    print(1,3)
    exit()

k  = (n*(n+1)-18)//12
res = [[k,k+1],[k+1,k+3],[k+3,k+2],[k+2,k]]
for i in range(1,n+1):
    if i in [k,k+1,k+2,k+3]:
        continue
    res.append([i,k])
    res.append([i,k+1])
    res.append([i,k+2])
    res.append([i,k+3])
print(len(res))
for e in res:
    print(e[0],e[1])

import sys
input = sys.stdin.readline

n = int(input())
if n == 3:
    print(2)
    print(1,3)
    print(2,3)
else:
    res = [[1,3],[2,3]]
    cnt = 0
    for i in range(4,n+1):
        if i%2 == 0:
            for j in range(len(res)):
                res[j] = [res[j][0]+1,res[j][1]+1]
            for j in range(2,i):
                res.append([1,j])
        else:
            for j in range(1,i):
                res.append([i,j])
    print(len(res))
    for e in res:
        print(e[0],e[1])
