n = int(input()) d = list(range(n)) ans = [] l = 0 r = n while r - l > 2: for i in range(l + 1, r - 1): ans.append((l, i)) l += 1 r -= 1 print(len(ans)) for u, v in ans: print(u + 1, v + 1)