import sys input = sys.stdin.readline N = int(input()) res = [] d = [0] * (N + 1) s = {0} for x in range(2, N + 1): y = x + 1 while y <= N and d[x] in s: res.append((x, y)) d[x] += 1 d[y] += 1 y += 1 s.add(d[x]) print(len(res)) for r in res: print(*r)