import itertools K = int(input()) N = (K - 1).bit_length() + 2 all_connect = K.bit_length() + 2 G = [(i, j) for i, j in itertools.combinations(range(1, all_connect), 2)] for i in range(N - 2): if (K >> i) & 1: G.append((i + 2, N)) M = len(G) print(N, M) for edge in G: print(*edge)