n = int(eval(input()))

if n%2 ==0:

  print(((n-1)*(n)//2-n//2))

else:

  print(((n-2)*(n-1)//2-(n-1)//2 +n-1))



if n%2 ==1:

  for i in range(n-1):

    print((i+1,n))

  n = n-1



if n%2 ==0:

  wa = n+1

  for i in range(n):

    for j in range(i+1,n):

      if wa != i+j+2:

        print((i+1,j+1))
n = int(eval(input()))



li = []



for i in range(0,(n//2)*2):

  if i+1 < n-i:

    li.append([i+1,n-i-n%2])

  else:

    break

if n%2 == 1:

  li.append([n])

if len(li) > 2:

  li.append(li[0])



count = 0

for i in range(1,len(li)):

  for j in li[i-1]:

    for k in li[i]:

      count += 1

print(count)

for i in range(1,len(li)):

  for j in li[i-1]:

    for k in li[i]:

      print((j,k))
n = int(eval(input()))
if n % 2 == 0:
    print(((n - 1) * (n) // 2 - n // 2))
else:
    print(((n - 2) * (n - 1) // 2 - (n - 1) // 2 + n - 1))
if n % 2 == 1:
    for i in range(n - 1):
        print((i + 1, n))
    n = n - 1
if n % 2 == 0:
    wa = n + 1
    for i in range(n):
        for j in range(i + 1, n):
            if wa != i + j + 2:
                print((i + 1, j + 1))

n = int(eval(input()))
li = []
for i in range(0, (n // 2) * 2):
    if i + 1 < n - i:
        li.append([i + 1, n - i - n % 2])
    else:
        break
if n % 2 == 1:
    li.append([n])
if len(li) > 2:
    li.append(li[0])
count = 0
for i in range(1, len(li)):
    for j in li[i - 1]:
        for k in li[i]:
            count += 1
print(count)
for i in range(1, len(li)):
    for j in li[i - 1]:
        for k in li[i]:
            print((j, k))

-if n % 2 == 0: -    print(((n - 1) * (n) // 2 - n // 2)) -else: -    print(((n - 2) * (n - 1) // 2 - (n - 1) // 2 + n - 1)) +li = [] +for i in range(0, (n // 2) * 2): +    if i + 1 < n - i: +        li.append([i + 1, n - i - n % 2]) +    else: +        break -    for i in range(n - 1): -        print((i + 1, n)) -    n = n - 1 -if n % 2 == 0: -    wa = n + 1 -    for i in range(n): -        for j in range(i + 1, n): -            if wa != i + j + 2: -                print((i + 1, j + 1)) +    li.append([n]) +if len(li) > 2: +    li.append(li[0]) +count = 0 +for i in range(1, len(li)): +    for j in li[i - 1]: +        for k in li[i]: +            count += 1 +print(count) +for i in range(1, len(li)): +    for j in li[i - 1]: +        for k in li[i]: +            print((j, k))