import sys def main(): N = int(sys.stdin.readline()) edges = [] # Use 0-indexed vertices for logic (0 to N-1), # then convert to 1-indexed for output (1 to N). # Connect vertex i and vertex j if i < j and i + j >= N - 1 for i in range(N): for j in range(i + 1, N): # Ensure i < j to avoid self-loops and duplicate edges if i + j >= N - 1: edges.append((i + 1, j + 1)) # Add 1 for 1-indexed output print(len(edges)) for u, v in edges: print(u, v) if __name__ == '__main__': main()