n = int(input()) cnt = 0 G = [[] for _ in range(n)] for i in range(n): for j in range(i + 1, n - i): G[i].append(j + 1) cnt += 1 print(cnt) for i in range(n): for j in G[i]: print(i + 1, j)