N = int(input()) print(N-1) for i in range(1,N//2 + 1): for j in range(i+1,N - i + 2): print(i,j)