n,a=int(input()),[] for i in range(n//2): for j in range(i+1,n-1):a.append((i+1,j+1)) print(len(a)) for u,v in a:print(u,v)