N=int(input()) E=[] for u in range(1,N//2+1): for v in range(u+1,N-u+2): E.append((u,v)) """ D=[0]*(N+1) for u,v in E: D[u]+=1 D[v]+=1 """ print(len(E)) for u,v in E: print(u,v)