n = int(input()) ans = [] min_ = 1 for i in range(n, -1, -1): for j in range(min_, i): ans.append((i, j)) min_ += 1 print(len(ans)) for row in ans: print(*row)