N = int(input()) v = N - 2 ans = [] ind = 1 while v >= 1: for i in range(1, v + 1): ans.append([ind, ind + i]) v -= 2 ind += 1 print(len(ans)) for u, v in ans: print(u, v)