Nauuo is a girl who loves playing chess.

One day she invented a game by herself which needs $n$ chess pieces to play on a $m\times m$ chessboard. The rows and columns are numbered from $1$ to $m$. We denote a cell on the intersection of the $r$-th row and $c$-th column as $(r,c)$.

The game's goal is to place $n$ chess pieces numbered from $1$ to $n$ on the chessboard, the $i$-th piece lies on $(r_i,\,c_i)$, while the following rule is satisfied: for all pairs of pieces $i$ and $j$, $|r_i-r_j|+|c_i-c_j|\ge|i-j|$. Here $|x|$ means the absolute value of $x$.

However, Nauuo discovered that sometimes she couldn't find a solution because the chessboard was too small.

She wants to find the smallest chessboard on which she can put $n$ pieces according to the rules.

She also wonders how to place the pieces on such a chessboard. Can you help her?


-----Input-----

The only line contains a single integer $n$ ($1\le n\le 1000$) — the number of chess pieces for the game.


-----Output-----

The first line contains a single integer — the minimum value of $m$, where $m$ is the length of sides of the suitable chessboard.

The $i$-th of the next $n$ lines contains two integers $r_i$ and $c_i$ ($1\le r_i,c_i\le m$) — the coordinates of the $i$-th chess piece.

If there are multiple answers, print any.


-----Examples-----
Input
2

Output
2
1 1
1 2
Input
4

Output
3
1 1
1 3
3 1
3 3


-----Note-----

In the first example, you can't place the two pieces on a $1\times1$ chessboard without breaking the rule. But you can place two pieces on a $2\times2$ chessboard like this:

[Image]

In the second example, you can't place four pieces on a $2\times2$ chessboard without breaking the rule. For example, if you place the pieces like this:

[Image]

then $|r_1-r_3|+|c_1-c_3|=|1-2|+|1-1|=1$, $|1-3|=2$, $1<2$; and $|r_1-r_4|+|c_1-c_4|=|1-2|+|1-2|=2$, $|1-4|=3$, $2<3$. It doesn't satisfy the rule.

However, on a $3\times3$ chessboard, you can place four pieces like this:

[Image]

Difficulty: EASY
Tags: Greedy algorithms

Constructive algorithms
Skill types: Greedy algorithms

Starter code:

Solutions:
n = int(input())
m = (n + 2) // 2
print(m)
c = 1
for i in range(1, m + 1):
	if c <= n:
		print(1, i)
		c += 1
for j in range(2, m + 1):
	if c <= n:
		print(j, m)
		c += 1


n = int(input())
m = n // 2 + 1
pan = [[j for j in range(i, m + i)] for i in range(1, m + 1)]
print(m)
x = 1
for i in range(m):
	for j in range(m):
		if pan[i][j] == x and x <= n:
			print(i + 1, j + 1)
			x += 1


from sys import stdin, stdout
from itertools import combinations
from collections import defaultdict, OrderedDict
import math
import heapq

def listIn():
	return list(map(int, stdin.readline().strip().split()))

def stringListIn():
	return [x for x in stdin.readline().split()]

def intIn():
	return int(stdin.readline())

def stringIn():
	return stdin.readline().strip()
n = intIn()
m = n // 2 + 1
print(m)
i = 1
j = m
for k in range(1, m + 1):
	print(k, i)
if n % 2 != 0:
	for k in range(2, m + 1):
		print(j, k)
else:
	for k in range(2, m):
		print(j, k)


from math import ceil
N = int(input())
Times = (N >> 1) + 1
print(Times)
i = 1
j = 1
for k in range(1, N + 1):
	print(i, j)
	if not k & 1:
		i += 1
	else:
		j += 1


n = int(input())
side = n // 2 + 1
arr = [[0 for i in range(side)] for j in range(side)]
num = 1
ans = []
for i in range(n):
	if num <= n:
		ans += [[i, i]]
		arr[i][i] = num
	num += 1
	if num <= n:
		ans += [[i, i + 1]]
		arr[i][i + 1] = num
	num += 1
print(side)
for x in ans:
	print(x[0] + 1, x[1] + 1)


from math import ceil
n = int(input())
x = ceil((n - 1) / 2) + 1
print(x)
for i in range(1, n // 2 + 1):
	print(1, i)
for i in range(1, ceil(n / 2) + 1):
	print(x, i)


n = int(input())
h = n // 2 + 1
w = n // 2 + 1
print(h)
for i in range(n):
	if i + 1 <= h:
		print(1, i + 1)
	else:
		print(i + 2 - h, h)


n = int(input())
nn = n + 1
if nn % 2 == 0:
	ans = nn // 2
else:
	ans = nn // 2 + 1
print(ans)
ct = 0
done = False
for i in range(1, ans + 1):
	if done:
		break
	print(1, i)
	ct += 1
	if ct >= n:
		done = True
for i in range(2, ans + 1):
	if done:
		break
	print(ans, i)
	ct += 1
	if ct >= n:
		done = True


n = int(input())
if n == 1:
	print(1)
	print(1, 1)
else:
	if n % 2 == 0:
		m = 2
		m += n / 2 - 1
	else:
		m = int(n / 2) + 1
	print(int(m))
	x = 1
	y = 1
	for i in range(1, n + 1):
		print(x, y)
		if i % 2 == 0:
			y += 1
		else:
			x += 1


n = int(input())
a = 1 + n // 2
print(a)
for i in range(1, n + 1):
	if i & 1:
		print(i // 2 + 1, i // 2 + 1)
	else:
		print(i // 2, i // 2 + 1)


n = int(input())
print(n // 2 + 1)
z = n // 2 + 1
i = 1
for j in range(1, z + 1):
	print('{} {}'.format(j, i))
i = 2
for j in range(z + 1, n + 1):
	print('{} {}'.format(z, i))
	i = i + 1


n = int(input())
m = n // 2 + 1
j = 1
k = 1
print(m)
while k <= n:
	print(k // 2 + 1, k // 2 + 1)
	k = k + 1
	if k <= n:
		print(k // 2, k // 2 + 1)
		k = k + 1


from math import ceil
from sys import stdin

def main():
	N = int(input())
	m = ceil(N ** 0.5)
	while 1:
		if m - 1 + m - 1 >= N - 1:
			break
		else:
			m += 1
	print(m)
	for c in range(1, m + 1):
		print(1, c)
		N -= 1
		if N == 0:
			return
	for r in range(2, m + 1):
		print(r, c)
		N -= 1
		if N == 0:
			return
input = lambda : stdin.readline()
main()


n = int(input())
print((n + 2) // 2)
for i in range(n):
	print(i // 2 + 1, i // 2 + 1 + i % 2)


import math
n = int(input())
m = math.ceil(n ** 0.5)
while 2 * (m - 1) < n - 1:
	m = m + 1
print(m)
N = n // 2
N1 = n - N
for i in range(N):
	print(1, i + 1)
for i in range(N1):
	print(m, i + 1)


n = int(input())
if n == 1:
	print(1)
	print(1, 1)
else:
	x = n // 2 + 1
	print(x)
	i = 1
	j = 1
	for k in range(n):
		print(i, j)
		i += k % 2 == 0
		j += k % 2


n = int(input())
if n == 1:
	print(1)
	print(1, 1)
elif n == 2:
	print(2)
	print(1, 1)
	print(1, 2)
else:
	x = (n + 1) / 2
	if x == int(x):
		x = int(x)
		print(x)
	else:
		x = int(x) + 1
		print(x)
	for i in range(1, x + 1):
		print(1, i)
	for j in range(2, x + 1):
		if j - 1 > n - x:
			break
		print(j, i)


import sys
import math
from functools import reduce
n = int(input())
m = 1
while True:
	if m * 2 <= n:
		m += 1
	else:
		break
print(m)
for x in range(m):
	print(1, x + 1)
t = n - m
for _ in range(n - m):
	print(m, m - t + 1)
	t -= 1


t = int(input())
if t == 1:
	print(1)
	print('1 1')
elif t == 2:
	print(2)
	print('1 1')
	print('2 1')
else:
	ans = 0
	for i in range(1, t + 2):
		inp = abs(i - 1) + abs(i - 1)
		if inp >= t - 1:
			ans = i
			break
	ls = []
	print(ans)
	ip = 2
	for j in range(1, ans + 1):
		for k in range(1, ans + 1):
			if abs(j - 1) + abs(k - 1) >= ip - 1:
				ls.append((j, k))
				ip = ip + 1
				if ip == t + 1:
					break
		if ip == t + 1:
			break
	print(1, 1)
	for i in ls:
		print(i[0], i[1])


n = int(input())
m = n // 2 + 1
print(m)
for i in range(1, m):
	print(1, i)
if n % 2 == 0:
	j = 2
else:
	j = 1
for i in range(n // 2 + 1, n + 1):
	print(m, j)
	j += 1


import math
n = int(input())
m = int(math.ceil((n + 1) / 2))
print(m)
for i in range(1, min(n + 1, m + 1)):
	print(f'1 {i}')
for i in range(2, n - m + 2):
	print(f'{i} {m}')


n = int(input())
m = n // 2 + 1
print('{}'.format(m))
r = 1
c = 1
dr = 0
dc = 1
for i in range(n):
	print('{} {}'.format(r, c))
	r += dr
	c += dc
	(dr, dc) = (dc, dr)


import math
mod = 1000000007

def power(a, b):
	res = 1
	b = b % (mod - 1)
	while b > 0:
		if b % 2 != 0:
			res = res % mod * (a % mod) % mod
		b = b // 2
		a = a % mod
		a = a * a % mod
	res = res % mod
	return res
n = int(input())
m = math.ceil((n + 1) / 2)
print(m)
for i in range(1, m + 1):
	print(1, i)
	n -= 1
	if n == 0:
		break
if n > 0:
	for i in range(2, m + 1):
		print(i, m)
		n -= 1
		if n == 0:
			break


n = int(input())
ansx = []
ansy = []
m = 1
x = 1
y = 1
ansx.append(1)
ansy.append(1)
for i in range(1, n):
	if x <= y:
		x += 1
		ansx.append(x)
		ansy.append(y)
	else:
		y += 1
		ansx.append(x)
		ansy.append(y)
if x <= y:
	m = y
else:
	m = x
print(m)
for i in range(n):
	print(ansx[i], ansy[i])


n = int(input())
hash = {}
count = 1
for i in range(1, 1000):
	hash[i] = count
	count += 2
z = 0
for i in hash.keys():
	if hash[i] >= n:
		z = i
		break
print(z)
l = []
co = 1
for i in range(z):
	k = [0] * z
	k[0] = co
	co += 1
	if i == z - 1:
		for j in range(1, z):
			k[j] = co
			co += 1
	l.append(k)
count = 0
for i in range(z):
	for j in range(z):
		k = l[i][j]
		if k != 0:
			print(i + 1, j + 1)
			count += 1
			if count == n:
				break
	if count == n:
		break


n = int(input())
a = [[0 for i in range(n)] for j in range(n)]
arr = [None] * 10001
a[0] = [1, 1]
a[0][0] = 1
row = 1
col = 2
arr[0] = [1, 1]
arr[1] = [1, 2]
i = 2
while i <= n:
	if i % 2 != 0:
		col += 1
	else:
		row += 1
	arr[i] = [row, col]
	i += 1
ans = max(arr[n - 1])
print(ans)
for i in range(n):
	print(*arr[i])


n = int(input())
ans = n // 2 + 1
print(ans)
for i in range(1, ans + 1):
	print('1 ' + str(i))
for i in range(2, n - ans + 2):
	print(str(ans) + ' ' + str(i))


n = int(input())
print(n // 2 + 1)
for c in range(1, n + 1):
	if c <= n // 2 + 1:
		print(c, 1)
	else:
		print(n // 2 + 1, c - n // 2)


from math import ceil
n = int(input())
m = ceil((n - 1) / 2) + 1
print(m)
count = 0
for i in range(1, m + 1):
	print(i, 1)
	count += 1
for j in range(2, m + 1):
	count += 1
	if count > n:
		break
	print(m, j)


from math import ceil
n = int(input())
ans = ceil((n + 1) / 2)
print(ans)
x = y = 1
for i in range(n):
	print(x, y)
	if x != ans:
		x += 1
	else:
		y += 1


import math
n = int(input())
m = math.ceil((n + 1) / 2.0)
print(m)
cnt = 0
for i in range(m):
	print(1, i + 1)
	cnt += 1
for j in range(m - 1):
	if cnt == n:
		break
	else:
		print(j + 2, i + 1)
		cnt += 1


def main():
	n = int(input())
	m = n // 2 + 1
	count = 0
	print(m)
	for j in range(1, m + 1):
		print(str(1) + ' ' + str(j))
		count += 1
		if count == n:
			return
	for i in range(2, m + 1):
		print(str(i) + ' ' + str(j))
		count += 1
		if count == n:
			return
main()


import os
import sys
from io import BytesIO, IOBase
import math

def main():
	n = int(input())
	m = math.ceil((n + 1) / 2)
	print(m)
	r = 1
	c = 1
	for i in range(n):
		if r <= m:
			print(r, c)
			r += 1
		else:
			c += 1
			print(m, c)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


n = int(input())
m = n // 2 + 1
print(n // 2 + 1)
k = 1
for i in range(0, m):
	print(k, end=' ')
	print(i + 1)
j = 2
for i in range(0, n - m):
	print(j, end=' ')
	print(m)
	j = j + 1


from math import *
n = int(input())
if n % 2 == 0:
	b = ceil(n / 2) + 1
else:
	b = ceil(n / 2)
if n == 1:
	print(1)
else:
	print(b)
x = 1
c = 0
if n == 1:
	print('1 1')
else:
	for y in range(1, b + 1):
		if c == n:
			break
		for z in range(1, b + 1):
			if x == 1:
				print(z, y)
				x += 1
				c += 1
			elif abs(y - 1) + abs(z - 1) >= x - 1:
				print(z, y)
				c += 1
				x += 1


x = int(input())
a = x
if a % 2 == 0:
	a = a / 2
	a = a + 1
else:
	a = a + 1
	a = a / 2
a = int(a)
print(a)
i = int(1)
j = int(1)
while j <= a:
	print('{} {}'.format(i, j))
	j = j + 1
	x = x - 1
i = 2
j = j - 1
while i <= x + 1:
	print('{} {}'.format(i, j))
	i = i + 1


def output():
	print(m)
	for i in range(n):
		print(coord_X[i], coord_Y[i])
n = int(input())
m = 0
while True:
	m += 1
	if m * m < n:
		continue
	if m * 2 - 2 < n - 1:
		continue
	tab = [[0 for i in range(m)] for j in range(m)]
	tab[0][0] = 1
	fig = [1]
	coord_X = [1]
	coord_Y = [1]
	L = 2
	for r in range(m):
		for c in range(m):
			if tab[r][c] != 0:
				continue
			fit = True
			rp = r + 1
			cp = c + 1
			for num_fig in range(len(fig)):
				if rp == coord_X[num_fig] and cp == coord_Y[num_fig]:
					continue
				elif abs(coord_X[num_fig] - rp) + abs(coord_Y[num_fig] - cp) < abs(L - fig[num_fig]):
					fit = False
					break
			if fit:
				tab[r][c] = L
				fig.append(L)
				coord_X.append(rp)
				coord_Y.append(cp)
				L += 1
				if len(fig) == n:
					output()
					raise SystemExit
	if len(fig) == n:
		output()
		raise SystemExit


n = int(input())
m = (n + 1) // 2 + (n + 1) % 2
print(m)
for j in range(1, m + 1):
	print(j, 1)
for j in range(2, m + 1):
	if j - 2 + m >= n:
		break
	print(j, m)


n = int(input())
print(n // 2 + 1)
while n:
	print(n // 2 + 1, (n - 1) // 2 + 1)
	n -= 1


from math import ceil
n = int(input())
m = ceil((n + 1) / 2)
print(m)
for k in range(m):
	print(k + 1, m)
ptr = 1 if n % 2 == 0 else 0
for k in range(m - 1, ptr, -1):
	print(m, k)


import bisect
import decimal
from decimal import Decimal
import os
from collections import Counter
import bisect
from collections import defaultdict
import math
import random
import heapq
from math import sqrt
import sys
from functools import reduce, cmp_to_key
from collections import deque
import threading
from itertools import combinations
from io import BytesIO, IOBase
from itertools import accumulate
decimal.getcontext().prec = 46

def primeFactors(n):
	prime = set()
	while n % 2 == 0:
		prime.add(2)
		n = n // 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			prime.add(i)
			n = n // i
	if n > 2:
		prime.add(n)
	return list(prime)

def getFactors(n):
	factors = []
	i = 1
	while i <= math.sqrt(n):
		if n % i == 0:
			if n // i == i:
				factors.append(i)
			else:
				factors.append(i)
				factors.append(n // i)
		i = i + 1
	return factors

def SieveOfEratosthenes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	num = []
	for p in range(2, n + 1):
		if prime[p]:
			num.append(p)
	return num

def lcm(a, b):
	return a * b // math.gcd(a, b)

def sort_dict(key_value):
	return sorted(key_value.items(), key=lambda kv: (kv[1], kv[0]))

def list_input():
	return list(map(int, input().split()))

def num_input():
	return map(int, input().split())

def string_list():
	return list(input())

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def binaryToDecimal(n):
	return int(n, 2)

def DFS(n, s, adj):
	visited = [False for i in range(n + 1)]
	stack = []
	stack.append(s)
	while len(stack):
		s = stack[-1]
		stack.pop()
		if not visited[s]:
			visited[s] = True
		for node in adj[s]:
			if not visited[node]:
				stack.append(node)

def maxSubArraySum(a, size):
	maxint = 10 ** 10
	max_so_far = -maxint - 1
	max_ending_here = 0
	for i in range(0, size):
		max_ending_here = max_ending_here + a[i]
		if max_so_far < max_ending_here:
			max_so_far = max_ending_here
		if max_ending_here < 0:
			max_ending_here = 0
	return max_so_far

def solve():
	k = int(input())
	if k == 1:
		print(1)
		print(1, 1)
		return
	if k == 2:
		print(2)
		print(1, 1)
		print(1, 2)
		return
	n = 2
	while 2 * n - 1 < k:
		n += 1
	r = c = 1
	flag = True
	print(n)
	while k > 0:
		if c <= n and flag:
			print(r, c)
			c += 1
		else:
			flag = False
			c = n
			r += 1
			print(r, c)
		k -= 1
t = 1
for _ in range(t):
	solve()


n = int(input())
if n % 2 == 0:
	m = (n + 2) // 2
	print(m)
else:
	m = (n + 1) // 2
	print(m)
cnt = 0
r = 1
c = 1
di = 0
while cnt < n:
	print(r, end=' ')
	print(c)
	if di == 0:
		if c == m:
			r += 1
			di == 1
		else:
			c += 1
	elif di == 1:
		r += 1
	cnt += 1


import math
n = int(input())
m = math.ceil((n + 1) / 2)

def g(m):
	for c in range(1, m + 1):
		yield (1, c)
	for r in range(2, m + 1):
		yield (r, m)
x = g(m)
print(m)
for i in range(n):
	(r, c) = next(x)
	print(f'{r} {c}')


import sys
import math
import array
import bisect
import collections
from collections import Counter, defaultdict
import fractions
import heapq
import re
sys.setrecursionlimit(1000000)

def array2d(dim1, dim2, init=None):
	return [[init for _ in range(dim2)] for _ in range(dim1)]

def argsort(l, reverse=False):
	return sorted(list(range(len(l))), key=lambda i: l[i], reverse=reverse)

def argmin(l):
	return l.index(min(l))

def YESNO(ans, yes='YES', no='NO'):
	print([no, yes][ans])
II = lambda : int(input())
MI = lambda : list(map(int, input().split()))
MIL = lambda : list(MI())
MIS = lambda : input().split()

def main():
	N = II()
	M = math.ceil((N + 1) / 2)
	print(M)
	(x, y) = (1, 1)
	for i in range(1, N + 1):
		print(x, y)
		if i % 2 == 0:
			y += 1
		else:
			x += 1

def __starting_point():
	main()
__starting_point()


n = int(input())
m = n // 2 + 1
print(m)
count = 0
for i in range(1, m + 1):
	print(1, i)
	count += 1
	if count == n:
		break
for i in range(2, m + 1):
	if count == n:
		break
	print(i, m)
	count += 1
	if count == n:
		break


n = int(input())
ans = 0
dist = []
for i in range(1, 10000):
	if 2 * i <= 1000:
		dist.append(2 * i)
	else:
		break
if n == 1:
	ans = 1
else:
	for i in range(len(dist)):
		if dist[i] >= n - 1:
			ans = i + 2
			break
if ans == 1:
	print(1)
	print('1 1')
else:
	print(ans)
	for i in range(1, ans + 1):
		if n == 0:
			break
		print(1, i)
		n -= 1
	for i in range(2, ans + 1):
		if n == 0:
			break
		print(i, ans)
		n -= 1


def chess(n):
	a = list()
	for i in range(1, n + 1):
		if i % 2 == 1:
			a.append([(i - 1) // 2 + 1, (i - 1) // 2 + 1])
		else:
			a.append([i // 2, i // 2 + 1])
	return a
m = int(input())
lst = chess(m)
if m % 2 == 0:
	print(m // 2 + 1)
else:
	print((m - 1) // 2 + 1)
for elem in lst:
	print(*elem)


def main():
	n = int(input())
	m = n // 2 + 1
	print(m)
	for i in range(m):
		print(str(i + 1) + ' 1')
	for i in range(m + 1, n + 1):
		print(str(m) + ' ' + str(i - m + 1))

def __starting_point():
	main()
__starting_point()


from collections import defaultdict as dd
import math
import sys
input = sys.stdin.readline

def nn():
	return int(input())

def li():
	return list(input())

def mi():
	return list(map(int, input().split()))

def lm():
	return list(map(int, input().split()))
n = nn()
size = (n + 2) // 2
print(size)
for i in range(size):
	print(1, i + 1)
for j in range(n - size):
	print(j + 2, size)


import sys
input = sys.stdin.readline
N = int(input())
ok = N ** 2 + 1
ng = -1
while ok - ng > 1:
	m = (ok + ng) // 2
	if m * 2 - 1 >= N:
		ok = m
	else:
		ng = m
print(ok)
for i in range(1, ok + 1):
	if N:
		print(1, i)
	N -= 1
for i in range(2, ok + 1):
	if N:
		print(ok, i)
	N -= 1


import sys

def get_array():
	return list(map(int, sys.stdin.readline().split()))

def get_ints():
	return map(int, sys.stdin.readline().split())

def input():
	return sys.stdin.readline().strip()

def main():
	n = int(input())
	ans = n // 2 + 1
	print(ans)
	r = 0
	c = 1
	for i in range(1, n + 1):
		if i % 2 == 1:
			r += 1
		else:
			c += 1
		print(r, c)
main()


ll = lambda : list(map(int, input().split()))
import math
testcases = 1
for testcase in range(testcases):
	[n] = ll()
	m = math.ceil((n + 1) / 2)
	print(m)
	for i in range(1, m + 1):
		print(1, i)
	for j in range(2, n - m + 2):
		print(j, m)


(N, Number) = (int(input()), 1)
while Number * 2 - 1 < N:
	Number += 1
(i, j, Counter) = (1, 1, 0)
print(Number)
while Counter != Number:
	print(i, j)
	(Counter, j) = (Counter + 1, j + 1)
(i, j) = (2, Number)
while Counter < N:
	print(i, j)
	(Counter, i) = (Counter + 1, i + 1)


a = int(input())
print(int(a / 2) + 1)
n = int(a / 2) + 1
s = [1, 1]
for i in range(a):
	print(str(s[0]) + ' ' + str(s[1]))
	if s[1] >= n:
		s[0] += 1
	else:
		s[1] += 1


import sys, math
data = sys.stdin.readlines()
n = int(data[0])
m = 1 + n // 2
print(m)
for i in range(1, n + 1):
	if i <= m:
		r = 1
		c = i
	else:
		r = i - m + 1
		c = m
	print(r, c)


from sys import stdin
input = stdin.readline
n = int(input())
p = 0
i = 1
while p < n - 1:
	i += 1
	p = i * 2 - 2
print(i)
for t in range(1, n + 1):
	if t > i:
		print(1 + t - i, i)
	else:
		print(1, t)


n = int(input())
c1 = 0
l = [(0, 1)]
if n == 1:
	print(1)
	print(1, 1)
elif n == 2:
	print(2)
	print(1, 1)
	print(1, 2)
else:
	while c1 < n:
		count = 0
		while count != 2:
			a = l[-1]
			if count == 0:
				b = a[0] + 1
				c = a[1]
				l.append((b, c))
				count = count + 1
			else:
				b = a[1] + 1
				c = a[0]
				l.append((c, b))
				count = count + 1
		c1 = c1 + 2
	l = l[1:n + 1]
	k = l[-1]
	print(max(k[0], k[1]))
	for i in range(0, len(l)):
		print(l[i][0], l[i][1])


n = int(input())
import math
m = math.ceil((n + 1) / 2)
print(m)
for i in range(n):
	if i < m:
		print(1, i + 1)
	elif i >= m:
		print(i - m + 2, m)


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


n = int(input())
m = 1
while 2 * (m - 1) + 1 < n:
	m += 1
print(m)
for i in range(1, m + 1):
	print(1, i)
	n -= 1
	if not n:
		break
if n:
	for i in range(2, m + 1):
		print(i, m)
		n -= 1
		if not n:
			break


def func(n, k):
	i = 1
	for i in range(k):
		print(f'{1} {i + 1}')
	a = k - (n - k) + 1
	while a < k or a == k:
		print(f'{k} {a}')
		a += 1
n = int(input())
k = int(n / 2 + 1)
print(k)
func(n, k)


n = int(input())
if n == 1:
	print(1)
	print(1, 1)
else:
	r = n // 2 + 1
	print(r)
	for i in range(r):
		print(1, i + 1)
	for j in range(n - r):
		print(j + 2, r)


n = int(input())
m = 0
if n % 2 == 0:
	t = n + 2
	m = int(t // 2)
else:
	t = n + 1
	m = int(t // 2)
print(m)
(r, c) = (1, 1)
print(r, c)
for i in range(1, n):
	if c == m:
		r = r + 1
	if c < m:
		c = c + 1
	print(r, c)


import sys
IS_LOCAL = False

def readInput():
	return int(input())

def writeResult(r):
	print(r)

def main():
	n = 1 if IS_LOCAL else readInput()
	m = n // 2 + 1
	print(m)
	for t in range(1, n + 1):
		(i, j) = ((t - 1) // 2 + 1, t // 2 + 1)
		print(f'{i} {j}')
if len(sys.argv) > 1 and sys.argv[1] == 'True':
	IS_LOCAL = True
main()


n = int(input())
ans = n // 2 + 1
print(ans)
for i in range(1, ans + 1):
	print(f'1 {i}')
for i in range(2, n - ans + 2):
	print(f'{ans} {i}')


import math
n = int(input())
m = math.ceil((n - 1) / 2) + 1
print(m)
print('1 1')
count = 1
for i in range(1, m + 1):
	for j in range(2, m + 1):
		if count >= n:
			exit()
		if abs(i - 1) + abs(j - 1) >= count:
			print(i, j)
			count += 1


def getN():
	return int(input())

def getList():
	return list(map(int, input().split()))
n = getN()
ans = n // 2 + 1
print(ans)
for i in range(n):
	if i < n // 2:
		print('{} {}'.format(1, i + 1))
	else:
		print('{} {}'.format(ans, ans - (n - i) + 1))


import math
n = int(input())
z = math.ceil((n + 1) / 2)
print(z)
for i in range(1, n + 1):
	if i <= z:
		print(i, 1)
	else:
		print(z, i - z + 1)


n = int(input(''))
c = 0
for i in range(0, n + 1, 2):
	c += 1
a = 1
b = 1
print(c)
for i in range(0, n):
	print(a, b)
	b += 1
	if i % 2 == 1:
		a = a + 1
		b -= 1


def main():
	n = int(input())
	ans = n // 2 + 1
	print(ans)
	for i in range(ans):
		print('1 {}'.format(i + 1))
	if n % 2 == 0:
		for i in range(1, ans - 1):
			print('{} {}'.format(i + 1, ans))
	else:
		for i in range(1, ans):
			print('{} {}'.format(i + 1, ans))
main()


n = int(input())
if n % 2 == 0:
	m = n // 2 + 1
else:
	m = (n + 1) // 2
c = 0
print(m)
for i in range(m):
	for j in range(1, 3):
		if c < n:
			print(i + 1, i + j)
			c += 1
		else:
			break


from math import *
from itertools import *
n = int(input())
m = 1
while 2 * (m - 1) < n - 1:
	m += 1
print(m)
x = 1
y = 1
while y <= m:
	print(x, y)
	y += 1
	n -= 1
x = m
y = m + 1
while n > 0:
	y -= 1
	n -= 1
while y <= m:
	print(x, y)
	y += 1


import math
n = int(input())
a = math.ceil((n + 1) / 2)
print(a)
for i in range(1, a + 1):
	print('1 ' + str(i))
for i in range(2, n - a + 2):
	print(str(i) + ' ' + str(a))


from sys import stdin, setrecursionlimit
import heapq

def create_matrix(m):
	matrix = [[0 for x in range(m)] for y in range(m)]
	return matrix

def check(num):
	if num * 2 - 1 >= n:
		return True
	else:
		return False

def print_matrix(m, matrix):
	count = 0
	x = 0
	y = 1
	flag = True
	while True:
		if count == n:
			break
		if flag:
			x += 1
			print(x, y)
			flag = False
			count += 1
		else:
			y += 1
			print(x, y)
			flag = True
			count += 1
n = int(stdin.readline().strip())
start = 1
end = 1000
matrix = create_matrix(250)
while True:
	if start >= end:
		if check(start - 1):
			start -= 1
		break
	mid = (start + end) // 2
	if check(mid):
		end = mid - 1
	else:
		start = mid + 1
if check(start):
	print(start)
	print_matrix(start, matrix)
else:
	check(start + 1)
	print(start + 1)
	print_matrix(start + 1, matrix)


n = int(input())
r = -1
if (n - 1) % 2 == 0:
	r = (n - 1) // 2
else:
	r = (n - 1) // 2
	r = r + 1
print(1 + r)
x = 1
y = 1
c = 0
i = 1
while i <= n:
	print(str(x) + ' ' + str(y))
	i += 1
	if c == 0:
		y += 1
		c = 1
	elif c == 1:
		x += 1
		c = 0


def main():
	buf = input()
	n = int(buf)
	m = n // 2 + 1
	print(m)
	for i in range(m):
		print(1, i + 1)
		n -= 1
	for i in range(m):
		if n > 0:
			print(i + 2, m)
			n -= 1
main()


n = int(input())
m = 2 * n - 1
for i in range(1, 1000):
	if 2 * i - 1 >= n:
		ans = i
		break
print(ans)
c = 0
for i in range(1, ans + 1):
	print(1, i)
	c += 1
	if c >= n:
		exit()
for i in range(2, ans + 1):
	print(ans, i)
	c += 1
	if c >= n:
		break


RI = lambda : [int(x) for x in input().strip().split()]
rw = lambda : input().strip().split()
n = int(input())
i = 1
j = 1
rc = 0
el = 0
if n == 1:
	print(1)
else:
	print(1 + n // 2)
while el != n:
	print(i, end=' ')
	print(j)
	if rc == 0:
		i += 1
		rc = 1
	else:
		j += 1
		rc = 0
	el += 1


from collections import Counter, deque, namedtuple, OrderedDict
from functools import reduce
from itertools import permutations, combinations
import math
n = int(input().strip())
distance = n - 1
m = 1 + math.ceil(distance / 2)
up_r = 0
up_c = 0
lo_r = m - 1
lo_c = m - 1
lo = 0
hi = n - 1
isup = False
out = [None] * n
while lo <= hi:
	if isup:
		out[hi] = (up_r, up_c)
		up_c += 1
		hi -= 1
	else:
		out[lo] = (lo_r, lo_c)
		lo_c -= 1
		lo += 1
	isup = not isup
print(m)
print('\n'.join(('%d %d' % (r + 1, c + 1) for (r, c) in out)))


import math
n = int(input())
d = n + 1
d = math.ceil(d / 2)
print(d)
r = 1
c = 1
print(r, c)
for i in range(2, n + 1):
	if i % 2 == 0:
		r += 1
		print(r, c)
	else:
		c += 1
		print(r, c)


num_pieces = int(input())
pieces = list(range(1, num_pieces + 1))
m = int(num_pieces / 2) + 1
print(m)
if num_pieces % 2 == 0:
	for a in range(1, m):
		print(1, a)
	for b in range(1, m):
		print(b + 1, m)
if num_pieces % 2 == 1:
	for a in range(1, m + 1):
		print(1, a)
	for b in range(1, m):
		print(b + 1, m)


import math
a = int(input())
m = math.ceil((a + 1) / 2)
print(m)
for i in range(1, min(a + 1, m + 1)):
	print(1, i)
	a = a - 1
for i in range(m - a + 1, m + 1):
	if a <= 0:
		break
	print(m, i)
	a = a - 1


N = int(input())
tmp = N
ans = 0
for b in range(1, 1000):
	if b + b - 1 >= N:
		ans = b
		break
print(ans)
for i in range(1, ans + 1):
	print(1, i)
	tmp -= 1
	if tmp == 0:
		exit()
for j in range(2, ans + 1):
	print(j, ans)
	tmp -= 1
	if tmp == 0:
		exit()


import sys, heapq
from collections import deque, defaultdict
printn = lambda x: sys.stdout.write(x)
inn = lambda : int(input())
inl = lambda : list(map(int, input().split()))
inm = lambda : map(int, input().split())
DBG = True

def ddprint(x):
	if DBG:
		print(x)
n = inn()
print(n // 2 + 1)
for i in range(n):
	print('{} {}'.format(i // 2 + 1, (i + 1) // 2 + 1))


n = int(input())
coord = []
coord.append([1, 1])
for i in range(1, n):
	if coord[i - 1][0] > coord[i - 1][1]:
		coord.append([coord[i - 1][0], coord[i - 1][1] + 1])
	else:
		coord.append([coord[i - 1][0] + 1, coord[i - 1][1]])
if coord[len(coord) - 1][0] > coord[len(coord) - 1][1]:
	print(coord[len(coord) - 1][0])
else:
	print(coord[len(coord) - 1][1])
for i in coord:
	print(*i)


def get_int_list():
	return list(map(int, input().split()))

def get_max_repeats(l):
	if len(l) == 0:
		return 0
	repeats = 1
	max_repeats = 1
	last_element = l[0]
	for i in range(1, len(l)):
		if l[i] == last_element:
			repeats += 1
		else:
			if repeats > max_repeats:
				max_repeats = repeats
			repeats = 1
		last_element = l[i]
	if repeats > max_repeats:
		max_repeats = repeats
	return max_repeats
from math import ceil
n = int(input())
m = ceil((n - 1) / 2) + 1
print(m)
places = []
count = 0
for i in range(m):
	if count < n:
		places.append((1, i + 1))
		count += 1
for i in range(1, m):
	if count < n:
		places.append((i + 1, m))
		count += 1
for place in places:
	print(str(place[0]) + ' ' + str(place[1]))


import math
n = int(input())
ans = n // 2 + 1
print(ans)
count = 0
i = 1
j = 1
while count < n:
	print(i, j)
	count += 1
	if count % 2 == 0:
		i += 1
	else:
		j += 1


__author__ = 'Esfandiar'
from math import ceil
n = int(input())
m = num = odd = even = 1
ans = list()
while num != n + 1:
	if num % 2:
		ans.append((odd, odd))
		odd += 1
	else:
		m += 1
		ans.append((even, even + 1))
		even += 1
	num += 1
print(m)
for (i, j) in ans:
	print(i, j)


n = int(input())
print((n + 2) // 2)
k = 1
i = j = 1
while k <= n:
	print(i, j)
	if k % 2 == 0:
		j += 1
	else:
		i += 1
	k += 1


n = int(input())
t = n // 2
print(t + +1)
for i in range(t):
	print(i + 1, i + 1)
	print(i + 1, i + 2)
if n % 2 == 1:
	print(t + 1, t + 1)


n = int(input())
m = -(-(n + 1) // 2)
a = [0] * n
for i in range(n // 2):
	a[i] = [1, i + 1]
r = 0
for i in range(n - 1, n // 2 - 1, -1):
	a[i] = [m, m - r]
	r += 1
print(m)
for i in a:
	print(*i)


from sys import *
from math import *
n = int(stdin.readline())
a = n - 1
x = a // 2 + 1
if a % 2 == 1:
	x += 1
print(x)
print(1, 1)
for i in range(2, n + 1):
	a = i - 1
	x = y = a // 2 + 1
	if a % 2 == 1:
		x += 1
	print(x, y)


n = int(input())
p = []
x = 1
y = 1
for i in range(1, n + 1):
	p.append((x, y))
	if i != n:
		if y <= x:
			y += 1
		else:
			x += 1
print(max(x, y))
for i in p:
	print(*i)


n = int(input())
a = []
x = 1
y = 1
for i in range(n):
	a.append((x, y))
	if i + 1 == n:
		break
	if x >= y:
		y += 1
	else:
		x += 1
print(max(x, y))
for e in a:
	print(' '.join([str(x) for x in e]))


n = int(input())
print(int(n / 2) + 1)
step = 0
idx = 1
jdx = 1
while n > 0:
	if step == 0:
		print(idx, jdx)
		jdx += 1
		step = 1
	else:
		print(idx, jdx)
		idx += 1
		step = 0
	n -= 1


n = int(input())
m = n // 2 + 1
(a, b) = (1, 1)
print(m)
print('%s %s' % (a, b))
if n % 2 == 1:
	for i in range(n // 2):
		a += 1
		print('%s %s' % (a, b))
		b += 1
		print('%s %s' % (a, b))
else:
	for i in range(n // 2 - 1):
		a += 1
		print('%s %s' % (a, b))
		b += 1
		print('%s %s' % (a, b))
	a += 1
	print('%s %s' % (a, b))


n = int(input())
m = int(n / 2) + 1
print(m)
pos = [(1, i) for i in range(1, m + 1, 1)] + [(j, m) for j in range(2, m + 1, 1)]
for v in pos[:n]:
	print(v[0], ' ', v[1])


list_lelo = lambda : list(map(int, input().split()))
int_lelo = lambda : int(input())
n = int_lelo()
ans = n // 2 + 1
print(ans)
for i in range(1, ans + 1):
	print(i, 1)
for j in range(2, n - ans + 2):
	print(ans, j)


import math
n = int(input())
m = math.floor(n / 2) + 1
(i, j, k) = (0, 1, 2)
print(m)
while i < n:
	print(1, j)
	i += 1
	j += 1
	if j == m + 1:
		while i < n:
			print(k, m)
			k += 1
			i += 1


import sys
input = sys.stdin.readline
print = sys.stdout.write
n = int(input())
m = n // 2 + 1
print(str(m) + '\n')
for i in range((n + 1) // 2):
	print(f'1 {i + 1}\n')
for i in range(n // 2):
	print(f'{m} {m - n // 2 + i + 1}\n')


import sys
n = int(sys.stdin.readline().strip())
m = n // 2 + 1
print(m)
for i in range(1, m + 1):
	print('1 ' + str(i))
for i in range(2, n - m + 2):
	print(str(i) + ' ' + str(m))


import sys
from collections import Counter

def input():
	return sys.stdin.readline().strip()

def dinput():
	return int(input())

def tinput():
	return input().split()

def rinput():
	return map(int, tinput())

def main():
	aleonov = int(input())
	leonov = aleonov // 2 + 1
	print(leonov)
	for i in range(leonov):
		print(1, i + 1)
	if aleonov % 2 == 0:
		for i in range(1, leonov - 1):
			print(i + 1, leonov)
	else:
		for i in range(1, leonov):
			print(i + 1, leonov)
main()


from math import *
n = int(input())
value = 0
flag = 0
if n % 2 != 0:
	tmp = n + 1
	value = tmp // 2
else:
	flag = 1
	tmp = n + 2
	value = tmp // 2
print(value)
i = 0
k = 0
while k < n - 2:
	print(i + 1, i + 1)
	print(i + 1, i + 2)
	i += 1
	k += 2
if flag == 1:
	print(i + 1, i + 1)
	print(i + 1, i + 2)
else:
	print(i + 1, i + 1)


from math import ceil
(N, Number) = (int(input()), 1)
while Number * 2 - 1 < N:
	Number += 1
(i, j, Counter) = (1, 1, 0)
print(Number)
while Counter != Number:
	print(i, j)
	(Counter, j) = (Counter + 1, j + 1)
(i, j) = (2, Number)
while Counter < N:
	print(i, j)
	(Counter, i) = (Counter + 1, i + 1)


n = int(input())
m = n // 2 + 1
print(m)
for i in range(1, n // 2 + 1):
	print(1, i)
M = 1
for i in range(n // 2 + 1, n + 1):
	print(m, M)
	M += 1


import math
import sys
n = int(input())
m = math.ceil((n - 1) / 2) + 1
print(m)
p = 1
for j in range(1, m + 1):
	print(1, p)
	p += 1
i = 0
t = m - (n - p)
while p <= n:
	print(m, t)
	p += 1
	t += 1


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


import math
b = int(input())
x1 = math.ceil((b + 1) / 2)
print(x1)
i = 0
x = 1
y = 1
while i < b:
	print(x, ' ', y)
	if i >= x1 - 1:
		y = y + 1
	else:
		x = x + 1
	i = i + 1


n = int(input())
if n == 1:
	print(1)
	print(1, 1)
elif n == 2:
	print(2)
	print(1, 1)
	print(1, 2)
else:
	first = n // 2
	second = first + 1
	print(second)
	for i in range(1, first + 1):
		print(1, i)
	for i in range(second, n + 1):
		print(second, i - first)


n = int(input())
i = 0
while 2 * i - 2 < n - 1:
	i += 1
print(i)
for x in range(i):
	print(x + 1, 1)
j = 2
for x in range(i, n):
	print(i, j)
	j += 1


import math
n = int(input())
m = math.ceil((n + 1) / 2.0)
print(m)
(x, y) = (1, 1)
for i in range(n):
	print(x, y)
	if i % 2:
		x += 1
	else:
		y += 1


n = int(input())
m = 0
m = n // 2 + 1
i = j = 1
po = 1
print(m)
while n:
	print(i, j)
	if po:
		j += 1
	else:
		i += 1
	po = not po
	n -= 1


t = int(input())
print(t // 2 + 1)
for i in range(1, t + 1):
	print('{} {}'.format(i // 2 + 1, i // 2 + 1)) if i & 1 else print('{} {}'.format(i // 2, i // 2 + 1))


n = int(input())
if (n - 1) % 2 == 1:
	c = (n - 1) // 2 + 1
else:
	c = (n - 1) // 2
c += 1
r = 1
print(c)
for i in range(1, n + 1):
	if i <= n - c:
		print('1', end=' ')
		print(i)
	else:
		print(c, end=' ')
		print(r)
		r += 1


n = int(input())
m = divmod(n, 2)[0] + 1
print(m)
for i in range(1, m + 1):
	print('1', i)
for j in range(2, n - m + 2):
	print(m, j)


from math import *
n = int(input())
m = int(ceil((n + 1) / 2))
print(m)
for i in range(n):
	if i + 1 < m:
		print(1, i + 1)
	else:
		print(i - m + 2, m)


n = int(input())
m = (n + 2) // 2
print(m)
for i in range(1, n + 1):
	if i <= m:
		print(i, 1, sep=' ')
	else:
		print(m, i - m + 1, sep=' ')


n = int(input())
m = (n + 2) // 2
ans = []
for i in range(1, n + 1):
	if i <= m:
		r = 1
		c = i
	else:
		r = m
		c = m - (n - i)
	ans.append((r, c))
print(m)
for i in range(n):
	print(*ans[i])


n = int(input())
ans = n // 2 + 1
ansarr = []
for i in range(ans):
	ansarr.append(1)
	ansarr.append(i + 1)
count = ans
for i in range(min(ans - 1, n - count)):
	ansarr.append(i + 2)
	ansarr.append(ans)
print(ans)
print(*ansarr)


def solve(n):
	maxDis = n - 1
	m = maxDis // 2 + 1
	if maxDis % 2 != 0:
		m += 1
	(r, c) = (1, 1)
	print(m)
	for x in range(n):
		times = x // 2
		remain = x % 2
		print(r + times, c + times + remain)
solve(int(input()))


import collections
n = int(input())
print(n // 2 + 1)
(i, j) = (1, 1)
for k in range(n):
	print(i, j)
	if i == j:
		j += 1
	else:
		i += 1


n = int(input())
(i, j) = (1, 1)
print(n // 2 + 1)
for qwq in range(n):
	print(str(i) + ' ' + str(j))
	if qwq & 1 == 0:
		i += 1
	else:
		j += 1


n = int(input())
print((n + 2) // 2)
p = 0
q = 1
for i in range(1, n + 1):
	if i & 1 == 1:
		p += 1
		print(p, q)
	else:
		q += 1
		print(p, q)


n = int(input())
print(n // 2 + 1)
k = n // 2 + 1
for i in range(1, k + 1):
	print(i, 1)
left = n - k
if left > 0:
	i = int(2)
	for i in range(left):
		print(k, i + 2)
		i += 1


from sys import stdin, setrecursionlimit
setrecursionlimit(10 ** 7)

def iin():
	return int(stdin.readline())

def lin():
	return list(map(int, stdin.readline().split()))

def main():
	n = iin()
	ans = n // 2 + 1
	print(ans)
	for i in range(1, ans + 1):
		print(1, i)
	for i in range(2, n - ans + 2):
		print(i, ans)
main()


n = int(input())
coords = []
if n % 2 == 0:
	m = n // 2 + 1
	for i in range(n // 2):
		coords.append([1, i + 1])
	for i in range(n // 2):
		coords.append([n // 2 + 1, i + 1])
else:
	m = (n + 1) // 2
	for i in range((n + 1) // 2):
		coords.append([1, i + 1])
	for i in range((n - 1) // 2):
		coords.append([n // 2 + 1, i + 2])
print(m)
for (x, y) in coords:
	print('%d %d' % (x, y))


n = int(input())
k = 1
a = [[0, 0] for i in range(n)]
c = 0
a[0][0] = 1
a[0][1] = 1
for i in range(1, n):
	if c == 0:
		a[i][0] = a[i - 1][0] + 1
		a[i][1] = a[i - 1][1]
		c = 1
	else:
		a[i][0] = a[i - 1][0]
		a[i][1] = a[i - 1][1] + 1
		c = 0
	k = max(a[i][0], a[i][1])
print(k)
for i in a:
	print(i[0], i[1])


n = int(input())
k = (n >> 1) + 1
print(k)
c = [1, 1]
i = 0
while n:
	print(*c)
	c[i] += 1
	i ^= 1
	n -= 1


n = int(input())
(c, f, i, j) = (0, 1, 1, 1)
l = []
while c != n:
	l.append((i, j))
	m = max(i, j)
	c += 1
	if f:
		j += 1
		f = 0
	else:
		i += 1
		f = 1
print(m)
for v in l:
	print(v[0], v[1])


def ii():
	return int(input())

def ss():
	return [x for x in input()]

def si():
	return [int(x) for x in input().split()]

def mi():
	return map(int, input().split())
a = ii()
s = 1
c = 1
while s < a:
	s += 2
	c += 1
print(c)
for i in range(1, c + 1):
	print(1, i)
for i in range(2, a - c + 2):
	print(i, c)


n = int(input())
points = []
for x in range(n):
	points.append((x // 2 + 1, (x + 1) // 2 + 1))
m = max(*points[-1])
print(m)
for point in points:
	print(' '.join(list(map(str, point))))


n = int(input())
i = 1
while n > 2 * i - 1:
	i += 1
print(i)
(a, b) = (1, 1)
for i in range(n):
	print(a, b)
	if i % 2 == 0:
		b += 1
	else:
		a += 1


from math import ceil
import sys
input = sys.stdin.readline

class Problem:

	def __init__(self):
		pass

	def solve(self):
		self._solve()

	def _solve(self):
		n = int(input())
		last = (1, 1)
		positions = [-1, (1, 1)]
		m = ceil((n + 1) / 2)
		print(m)
		done = 0
		for i in range(m):
			print(1, i + 1)
			done += 1
			if done == n:
				return
		for i in range(1, m):
			print(m, i + 1)
			done += 1
			if done == n:
				return

def main():
	problem = Problem()
	problem.solve()
main()


n = int(input())
print((n + 2) // 2)
x = y = 1
while n:
	print(x, y)
	n -= 1
	if x == y:
		y += 1
	else:
		x += 1


n = int(input())
m = n // 2 + 1
print(m)
i = 1
for j in range(m):
	print(str(i) + ' 1')
	i += 1
	n -= 1
i = 2
while n > 0:
	print(str(m) + ' ' + str(i))
	i += 1
	n -= 1


n = int(input())
if n == 1:
	print(1)
	print('1 1')
	exit(0)
i = 1
while 2 * (i - 1) < n - 1:
	i += 1
print(i)
print('1 1')
n -= 2
if n > 0:
	for j in range(2, i + 1):
		print('1' + ' ' + str(j))
		n -= 1
		if n == 0:
			break
if n > 0:
	for j in range(2, i):
		print(str(i) + ' ' + str(j))
		n -= 1
		if n == 0:
			break
print(str(i) + ' ' + str(i))


from sys import stdin

def input():
	return stdin.readline()
n = int(input())
m = n // 2 + 1
print(n // 2 + 1)
res = []
count = 0
for i in range(m):
	for j in range(m):
		if i + j >= count and count < n:
			res.append([i + 1, j + 1])
			count += 1
for i in range(n):
	print(*res[i])


import math
import sys
from collections import *
import itertools

def cint():
	return list(map(int, sys.stdin.readline().strip().split()))

def cstr():
	return list(map(str, input().split(' ')))

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

def solve(t):
	n = int(input())
	r = (n + 1) // 2
	if (n + 1) / 2 != (n + 1) // 2:
		r += 1
	print(r)
	indx = 1
	for i in range(n):
		if i < r:
			print(0 + 1, i + 1)
		else:
			print(indx + 1, r)
			indx += 1
t = 1
for i in range(1, t + 1):
	solve(i)


import sys
import string
from collections import Counter, defaultdict
from math import fsum, sqrt, gcd, ceil, factorial
from operator import *
from itertools import accumulate
inf = float('inf')
flush = lambda : sys.stdout.flush
comb = lambda x, y: factorial(x) // factorial(y) // factorial(x - y)
ip = lambda : input()
ii = lambda : int(input())
r = lambda : map(int, input().split())
rr = lambda : list(r())
n = ii()
c = n // 2 + 1
print(c)
i = j = 1
arr = []
while j <= c:
	arr += ([i, j],)
	j += 1
i = c
j = 2
while j <= c:
	arr += ([i, j],)
	j += 1
for i in arr[:n]:
	print(*i)


n = int(input())
if n == 1:
	print(1)
	print(1, '', 1)
	exit()
for i in range(1, n):
	if i * 2 >= n - 1:
		m = i + 1
		break
print(m)
j = 1
k = 1
count = 0
for i in range(0, n):
	print(k, '', j)
	if k == m:
		k = m
		j += 1
	else:
		k += 1


INF = 100000000
t = 1
for test in range(t):
	n = int(input())
	print(n // 2 + 1)
	for i in range(n // 2 + 1):
		print(1, i + 1)
	cur = 2
	for i in range(n // 2 + 1, n):
		print(cur, n // 2 + 1)
		cur += 1


n = int(input())
row = 1
col = 1
coor = ['1 1']
right = True
for i in range(1, n):
	if right == True:
		right = False
		col += 1
	else:
		right = True
		row += 1
	coor.append(str(row) + ' ' + str(col))
print(max(row, col))
for i in coor:
	print(i)


from sys import stdin
import math
from collections import defaultdict, deque
import bisect
I = stdin.readline
n = int(I())
print(n // 2 + 1)
(r, c) = (1, 1)
for i in range(1, n + 1):
	print(r, c)
	if i & 1 == 1:
		c += 1
	else:
		r += 1


import math
n = int(input())
if n == 1:
	print(1)
	print(1, 1)
	exit()
dim = (n + 2) // 2
cc = 0
x = 1
y = 1
print(dim)
cc = 0
while 1:
	if cc == n:
		break
	print(x, y)
	if x < dim:
		x += 1
		cc += 1
		continue
	else:
		y += 1
		cc += 1


n = int(input())
(x, y) = (1, 1)
loc = []
loc.append((x, y))
for i in range(2, n + 1):
	if x > y:
		y += 1
	else:
		x += 1
	loc.append((x, y))
print(x)
for (i, j) in loc:
	print(i, j)


import sys
input = sys.stdin.readline
n = int(input())
ans = int(n / 2) + 1
print(ans)
(i, j) = (1, 1)
m = n
while m > 0:
	print(i, j)
	if i == ans:
		j += 1
	else:
		i += 1
	m -= 1


n = int(input())
r = []
c = []
rr = []
cc = []
if n % 2 == 1:
	m = (n - 1) // 2
	m += 1
else:
	m = n // 2
	m += 1
counter = m
for i in range(n):
	if i <= m - 1:
		r.append(1)
		c.append(i + 1)
	else:
		rr.append(m)
		cc.append(counter)
		counter -= 1
rr = rr[::-1]
cc = cc[::-1]
r = r + rr
c = c + cc
print(m)
for i in range(n):
	arr = []
	arr.append(r[i])
	arr.append(c[i])
	print(*arr)


n = int(input())
x = n // 2 + 1
print(x)
while n:
	n -= 1
	y = n // 2 + 1
	print(x, y)
	x = y


n = int(input())
dist = n - 1
if dist == 0:
	print(1)
	print(1, 1)
else:
	start = 1
	size = 2
	while True:
		if start <= dist < start + 2:
			print(size)
			row = 1
			column = 1
			while row <= size and column <= size and (n != 0):
				if column != size:
					print(row, column)
					column += 1
				else:
					print(row, column)
					row += 1
				n -= 1
			break
		else:
			start += 2
			size += 1


n = input()
n = int(n)
print(int(n / 2) + 1)
row = 1
col = 1
count = 1
for i in range(n):
	print(row, col)
	if count == 2:
		count = 0
		col += 1
	else:
		row += 1
	count += 1


def STR():
	return list(input())

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def MAP2():
	return map(float, input().split())

def LIST():
	return list(map(int, input().split()))

def STRING():
	return input()
import string
import sys
from heapq import heappop, heappush
from bisect import *
from collections import deque, Counter, defaultdict
from math import *
from itertools import permutations, accumulate
dx = [-1, 1, 0, 0]
dy = [0, 0, 1, -1]
n = INT()
k = n - 1
m = -1
for i in range(1, 1009):
	if (i - 1) * 2 >= k:
		m = i
		break
print(m)
ans = []
j = 1
cnt = 0
for i in range(1, m + 1):
	if cnt < n:
		ans.append((j, i))
		cnt += 1
	else:
		break
j = 2
for i in range(m + 1, n + 1):
	ans.append((i - j + 1, j))
	j += 1
for i in ans:
	print(*i)


import math

def r(v):
	if (v - 1) % 2:
		return int((v - 1) / 2) + 1
	return int((v - 1) / 2)
n = int(input())
a = r(n)
x = 1
y = 1
print(1 + a)
for t in range(a + 1):
	print(x + t, y)
for t in range(a + 1, n):
	print(a + 1, 1 + t - a)


import atexit
import io
import sys
from math import ceil
_I_B = sys.stdin.read().splitlines()
input = iter(_I_B).__next__
_O_B = io.StringIO()
sys.stdout = _O_B

@atexit.register
def write():
	sys.__stdout__.write(_O_B.getvalue())

def main():
	n = int(input())
	m = 1 + n // 2
	print(m)
	c = m
	while c:
		print(c, 1)
		c -= 1
	c = 2
	while c < m:
		print(1, c)
		c += 1
	if n != 1 and n & 1:
		print(1, m)
main()


n = int(input())
print(n // 2 + 1)
for x in range(n):
	print(x // 2 + 1, (x + 1) // 2 + 1)


import copy
n = int(input())
m = 1
for i in range(1, 1001):
	if abs(i - 1) + abs(i - 1) >= n - 1:
		m = i
		break
print(m)
for i in range(1, m + 1):
	print(1, i)
rem = n - m
while rem > 0:
	rem -= 1
	print(m, m - rem)


def ain():
	return map(int, input().split())

def lin():
	return list(ain())

def plist(l):
	for x in l:
		print(x, end=' ')
	print()
n = int(input())
x = 0
while 2 * x - 1 < n:
	x += 1
print(x)
fl = 0
k = 0
for i in range(x):
	print(i + 1, 1)
	k += 1
	if k == n:
		break
for i in range(x - 1):
	if k == n:
		break
	print(x, i + 2)
	k += 1


def compute(n):
	arr = [(1, 1)]
	cur = [1, 1]
	for i in range(1, n):
		if i % 2 == 0:
			cur[0] = cur[0] + 1
		else:
			cur[1] = cur[1] + 1
		arr.append(cur.copy())
	m = max(cur)
	print(m)
	return arr

def main():
	n = int(input())
	tups = compute(n)
	for i in range(n):
		(x, y) = tups[i]
		print(str(x) + ' ' + str(y))
main()


n = int(input())
i = 0
while 2 * i + 1 < n:
	i += 1
a = i + 1
b = n - a
print(a)
for j in range(1, a + 1):
	print(1, j)
for j in range(1, b + 1):
	print(j + 1, a)


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
mod = 10 ** 9 + 7

def LI():
	return list(map(int, input().split()))

def I():
	return int(input())

def LS():
	return input().split()

def S():
	return input()

def main():
	n = I()
	x = n // 2 + 1
	print(x)
	for i in range(n):
		if i % 2 == 0:
			print(i // 2 + 1, i // 2 + 1)
		else:
			print(i // 2 + 1, i // 2 + 2)
main()


import sys
input = sys.stdin.readline
n = int(input())
m = n // 2 + 1
print(m)
for i in range((n + 1) // 2):
	print(1, i + 1)
for i in range(n // 2):
	print(m, m - n // 2 + i + 1)


for _ in range(1):
	n = int(input())
	if n % 2 == 1:
		m = (n - 1) // 2 + 1
		print(m)
		k = 0
		for i in range(1, m):
			print(1, i)
			k += 1
		i = 1
		while k < n:
			print(m, i)
			i += 1
			k += 1
	else:
		m = n // 2 + 1
		print(m)
		k = 0
		for i in range(1, m):
			print(1, i)
			k += 1
		i = 1
		while k < n:
			print(m, i)
			i += 1
			k += 1


from math import ceil
num = int(input())
leng = ceil((num + 1) / 2)
print(leng)
for i1 in range(leng):
	print('1 ' + str(i1 + 1))
for i2 in range(num - leng):
	print(str(i2 + 2) + ' ' + str(leng))


import math

def main():
	n = int(input())
	m = 1 + math.ceil((n - 1) / 2)
	(x, y) = (1, 1)
	print(int(m))
	for i in range(1, n + 1):
		diff = i - 1
		x1 = x + diff // 2
		y1 = y + math.ceil(diff / 2)
		print(x1, int(y1))
main()


n = int(input())
a = n // 2
print(a + 1)
for i in range(n):
	t = i // 2 + 1
	y = i % 2
	print(t + y, t)


import math
from collections import deque, defaultdict
from sys import stdin, stdout
input = stdin.readline
listin = lambda : list(map(int, input().split()))
mapin = lambda : map(int, input().split())
n = int(input())
x = math.ceil((n - 1) / 2 + 1)
print(x)
ans = []
for i in range(1, x + 1):
	print(1, i)
for i in range(n - x):
	ans.append((x, x - i))
ans.reverse()
for i in ans:
	print(*i)


import math

def main():
	N = int(input())
	S = int(N / 2) + 1
	r = 1
	c = 1
	print(S)
	for i in range(1, N + 1):
		print(f'{r} {c}')
		if i % 2:
			c += 1
		else:
			r += 1
main()


n = int(input())
if n == 1:
	print(1)
	print('1 1')
	exit()
if n == 2:
	print(2)
	print('1 1')
	print('1 2')
	exit()
if n % 2 == 1:
	print(n // 2 + 1)
	for i in range(1, n // 2 + 2):
		print(f'1 {i}')
	for i in range(1, n // 2 + 1):
		print(f'{n // 2 + 1} {i + 1}')
else:
	print(n // 2 + 1)
	for i in range(1, n // 2 + 1):
		print(f'1 {i}')
	for i in range(1, n // 2 + 1):
		print(f'{n // 2 + 1} {i}')


import sys
input = sys.stdin.readline
n = int(input())
res = [(1, 1)]
count = 1
for i in range(2, n + 1):
	if i % 2 == 0:
		x = (res[-1][0], res[-1][1] + 1)
		count += 1
	else:
		x = (res[-1][0] + 1, res[-1][1])
	res.append(x)
print(count)
for r in res:
	print(r[0], r[1])


from math import ceil

class cinn:

	def __init__(self):
		self.x = []

	def cin(self, t=int):
		if len(self.x) == 0:
			a = input()
			self.x = a.split()
			self.x.reverse()
		return self.get(t)

	def get(self, t):
		return t(self.x.pop())

	def clist(self, n, t=int):
		l = [0] * n
		for i in range(n):
			l[i] = self.cin(t)
		return l

	def clist2(self, n, t1=int, t2=int, t3=int, tn=2):
		l = [0] * n
		for i in range(n):
			if tn == 2:
				a1 = self.cin(t1)
				a2 = self.cin(t2)
				l[i] = (a1, a2)
			elif tn == 3:
				a1 = self.cin(t1)
				a2 = self.cin(t2)
				a3 = self.cin(t3)
				l[i] = (a1, a2, a3)
		return l

	def clist3(self, n, t1=int, t2=int, t3=int):
		return self.clist2(self, n, t1, t2, t3, 3)

	def cout(self, i, ans=''):
		if ans == '':
			print('Case #' + str(i + 1) + ':', end=' ')
		else:
			print('Case #' + str(i + 1) + ':', ans)

	def printf(self, thing):
		print(thing, end='')

	def countlist(self, l, s=0, e=None):
		if e == None:
			e = len(l)
		dic = {}
		for el in range(s, e):
			if l[el] not in dic:
				dic[l[el]] = 1
			else:
				dic[l[el]] += 1
		return dic

	def talk(self, x):
		print(x, flush=True)

	def dp1(self, k):
		L = [-1] * k
		return L

	def dp2(self, k, kk):
		L = [-1] * k
		for i in range(k):
			L[i] = [-1] * kk
		return L
c = cinn()
x = c.cin()
size = x // 2 + 1
print(size)
for i in range(1, x + 1):
	print(i // 2 + 1, ceil(i / 2))


import math
n = int(input())
m = math.ceil((n + 1) / 2)
d = dict()
d[1] = [1, 1]
d[2] = [1, 2]
d[3] = [2, 2]
for i in range(4, n + 1):
	temp = (i + 1) / 2
	d[i] = [math.floor(temp), math.ceil(temp)]
print(m)
for i in range(1, n + 1):
	print(d[i][0], d[i][1])


n = int(input())
print((n + 2) // 2)
for i in range(n):
	a = i // 2 + 1
	b = a + i % 2
	print(a, b)


from math import ceil
n = int(input().strip())
print(n // 2 + 1)
c = 1
while c <= n:
	if c % 2:
		x = ceil(c / 2)
		print(x, x)
	else:
		x = c // 2
		y = c // 2 + 1
		print(x, y)
	c += 1


import sys
input = sys.stdin.readline
for _ in range(1):
	n = int(input())
	print(n // 2 + 1)
	e = n // 2 + 1
	ans = []
	cnt = 0
	for i in range(1, e + 1):
		if cnt == n:
			break
		ans.append((1, i))
		cnt += 1
	for i in range(2, e + 1):
		if cnt == n:
			break
		ans.append((i, e))
		cnt += 1
	for i in ans:
		print(*i)


n = int(input())
m = n // 2 + 1
print(m)
a = [[i + j + 1 for i in range(m)] for j in range(m)]
b = []
l = 1
i = 0
j = 0
while l <= n:
	if a[i][j] == l:
		b.append((i + 1, j + 1))
		l += 1
	j += 1
	if j >= m:
		j = 0
		i += 1
for i in b:
	print(*i)


import math
x = int(input())
y = math.ceil((x - 1) / 2 + 1)
print(y)
for i in range(1, x + 1):
	if i <= y:
		print('1 ' + str(i))
	else:
		print(str(i - y + 1) + ' ' + str(y))


import math
n = int(input())
if n == 1:
	print('1\n1 1')
	exit()
m = n // 2 + 1
print(m)
for i in range(1, m + 1):
	print(1, i)
cnt = m
temp = []
for i in reversed(range(1, m + 1)):
	if cnt == n:
		break
	temp.append((m, i))
	cnt += 1
for i in temp[::-1]:
	print(*i)


from math import ceil
n = int(input())
m = ceil((n + 1) / 2)
c = 0
print(m)
(i, j) = (1, 1)
while j <= m:
	if c == n:
		break
	print(i, j)
	c += 1
	j += 1
j -= 1
i += 1
while i <= m:
	if c == n:
		break
	print(i, j)
	i += 1
	c += 1


gi = lambda : list(map(int, input().strip().split()))
(n,) = gi()
t = n
n = n // 2 + 1
print(n)
l = ['1 ' + str(k) for k in range(1, n + 1)]
u = [str(k) + ' ' + str(n) for k in range(n, 1, -1)]
u = u[:t - len(l)][::-1]
print('\n'.join(l + u))


def __starting_point():
	n = int(input())
	m = int(n / 2 + 1)
	print(m)
	for i in range(1, n + 1):
		if i <= m:
			print(1, i)
		else:
			print(i - m + 1, m)
__starting_point()


n = int(input())
first = n // 2
second = first + 1
print(second)
for i in range(1, first + 1):
	print(1, i)
for i in range(second, n + 1):
	print(second, i - first)


import math
from collections import Counter
n = int(input())
a = (n + 2) // 2
l = [[0] * a for i in range(a)]
print(a)
if n <= a:
	for i in range(1, n + 1):
		print(1, i)
else:
	for i in range(1, a + 1):
		print(1, i)
	for i in range(2, 2 + n - a):
		print(i, a)


import sys
input = sys.stdin.readline
N = int(input())
M = (N + 2) // 2
print(M)
(r, c) = (1, 1)
for _ in range(N):
	print(r, c)
	if r < M:
		r += 1
	else:
		c += 1


n = int(input())
m = (n + 2) // 2
x = y = 1
q = 1
print(m)
while q != n + 1:
	print(x, y)
	if x < m:
		x += 1
	else:
		y += 1
	q += 1


n = int(input())
k = n // 2 + 1
print(k)
i = 1
while i <= k:
	print(i, '1')
	i = i + 1
j = 2
while j <= n - k + 1:
	print(k, j)
	j = j + 1


from sys import stdin
input = stdin.readline
n = int(input())
res = n // 2 + 1
ans = [(1, 1 + i) for i in range(n - min(n, res))] + [(res, res - i) for i in reversed(range(min(n, res)))]
print(res)
print('\n'.join([f'{x} {y}' for (x, y) in ans]))


n = int(input())
ans = n // 2 + 1
print(ans)
print(1, 1)
cnt = 2
cnt2 = 1
for i in range(1, n):
	print(cnt, cnt2)
	if i % 2 == 0:
		cnt += 1
	else:
		cnt2 += 1


n = int(input())
print((n + 2) // 2)
row = col = 1
(di, dj) = (0, 1)
for k in range(n):
	print(row, col, sep=' ')
	row += di
	col += dj
	(di, dj) = (dj, di)


n = int(input())
res = [(1, 1)]
up = True
for _ in range(n - 1):
	(x, y) = res[-1]
	if up:
		res.append((x, y + 1))
	else:
		res.append((x + 1, y))
	up = not up
size = max(res[-1])
print(size)
for (x, y) in res:
	print(x, y)


n = int(input())
if n < 3:
	if n == 1:
		m = 1
	else:
		m = 2
else:
	if n % 2 == 0:
		m = n // 2 + 1
	else:
		m = (n + 1) // 2
	if m * m == n:
		m += 1
i = 1
j = 1
k = 2
cnt = 1
print(m)
while cnt <= n:
	if i < m:
		print(1, i)
		i += 1
		cnt += 1
	else:
		print(m, j)
		j += 1
		cnt += 1


n = int(input())
r = []
c = []
mat = set()
m = 0
n_ = 1
while len(r) < n:
	m_ = (n_ - 1) // 2 + 1
	if m_ > m:
		m = m_
	bval = True
	while bval:
		for c_ in range(max(n_ - m + 1, 1), m + 1):
			if m - 1 + (c_ - 1) >= n_ - 1:
				if not (m, c_) in mat:
					r.append(m)
					c.append(c_)
					mat.add((m, c_))
					bval = False
					break
		if bval:
			m += 1
	n_ += 1
print(m)
for i in range(n):
	print(r[i], c[i])


import sys
import os
import math
import copy
from math import gcd
from bisect import bisect
from io import BytesIO, IOBase
from math import sqrt, floor, factorial, gcd, log, ceil
from collections import deque, Counter, defaultdict
from itertools import permutations, combinations
import itertools

def Int():
	return int(sys.stdin.readline())

def Mint():
	return map(int, sys.stdin.readline().split())

def Lstr():
	return list(sys.stdin.readline().strip())

def Str():
	return sys.stdin.readline().strip()

def Mstr():
	return map(str, sys.stdin.readline().strip().split())

def List():
	return list(map(int, sys.stdin.readline().split()))

def Hash():
	return dict()

def Mod():
	return 1000000007

def Ncr(n, r, p):
	return fact[n] * (ifact[r] * ifact[n - r] % p) % p

def Most_frequent(list):
	return max(set(list), key=list.count)

def Mat2x2(n):
	return [List() for _ in range(n)]

def Lcm(x, y):
	return x * y // gcd(x, y)

def dtob(n):
	return bin(n).replace('0b', '')

def btod(n):
	return int(n, 2)

def common(l1, l2):
	return set(l1).intersection(l2)

def solution():
	N = Int()
	c = 0
	(a, b) = (1, 1)
	ans = [[1, 1]]
	for i in range(1, N):
		if i % 2 == 0:
			a = a + 1
		else:
			b += 1
		ans.append([a, b])
	print(N // 2 + 1)
	for i in ans:
		print(*i)
solution()


while True:
	try:
		n = int(input())
		m = (n + 2) // 2
		print(m)
		for i in range(m):
			print('{0} {1}'.format(1, i + 1))
		for i in range(2, n - m + 2):
			print(i, m)
	except:
		break


import sys, collections
n = int(sys.stdin.readline())
size = n // 2 + 1
print(size)
for i in range(n // 2 + 1):
	print(1, i + 1)
idx = 2
for i in range(n // 2 + 1, n):
	print(size, idx)
	idx += 1


import sys
import math
from itertools import permutations
input = sys.stdin.readline
n = int(input())
minn = n // 2 + 1
print(minn)
for i in range(minn):
	print(1, i + 1)
left = n - minn
for i in range(left):
	print(i + 2, minn)


n = int(input())
m = n // 2 + 1
print(m)
for i in range(1, n + 1):
	print('{} {}'.format((i - 1) // 2 + 1, (i - 1) // 2 + 1 + (i - 1) % 2))


from math import *
from collections import *
import sys
sys.setrecursionlimit(10 ** 9)
n = int(input())
s = n // 2 + 1
print(s)
ct = 0
x = 1
y = 1
for i in range(n):
	print(x, y)
	if x < s:
		x += 1
	else:
		y += 1


i1 = int(input())
if i1 % 2 == 0:
	m = (i1 + 2) // 2
	print(m)
	for i in range(1, m + 1):
		print('1', i)
		i += 1
	for i in range(1, m - 1):
		print(m, i + 2)
		i += 1
else:
	m = (i1 + 1) // 2
	print(m)
	for i in range(1, m + 1):
		print('1', i)
		i += 1
	for i in range(1, m):
		print(m, i + 1)
		i += 1


n = int(input())
m = 1
while 1:
	if m * m >= n and (m - 1) * 2 >= n - 1:
		break
	else:
		m += 1
print(m)
i = 1
j = 1
for x in range(n):
	if i < m:
		print(i, j)
		i += 1
	else:
		print(i, j)
		j += 1


import sys
import os
from io import BytesIO, IOBase

def cel(n, k):
	return n // k + (n % k != 0)

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return list(map(int, input().split()))

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def prr(a, sep=' '):
	print(sep.join(map(str, a)))

def dd():
	return defaultdict(int)

def ddl():
	return defaultdict(list)

def ddd():
	return defaultdict(defaultdict(int))
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
from collections import defaultdict
n = ii()
print(n // 2 + 1)
print(1, 1)
f = 0
r = 1
c = 1
for i in range(n - 1):
	if f == 0:
		c += 1
		print(r, c)
		f = 1
	else:
		r += 1
		print(r, c)
		f = 0


t = int(input())
m = t // 2 + 1
print(m)
for i in range(1, m + 1):
	print(i, 1)
r = t - m
for i in range(m - r + 1, m + 1):
	print(i, m)