N = gets.to_i

def get_divider(n)
	(2..n).each{|i|
		if n % i == 0
			return i
		end
	}
end

def divide(i, s)
	list = []
	items = (1..i).to_a
	
	while n = items.pop
		sum = n
		l = [n]
		while sum < s
			j = items.length - 1
			while j >= 0
				if items[j] <= s - sum
					break
				end
				j -= 1
			end
			if j >= 0
				item = items[j]
				sum += item
				l << item
				items.delete_at(j)
			else
				puts "error"
				exit
			end
		end
		list << l
	end
	return list
end


sum = (N + 1) * N / 2
n = get_divider(sum)
s = sum / n
list = divide(N, s)

#p list
vs = []

if list.length > 2
	n.times{|i|
		l1 = list[i - 1]
		l2 = list[i]
		
		l1.each{|v1|
			l2.each{|v2|
				vs << [v1, v2]
			}
		}
	}
else
	l1 = list[0]
	l2 = list[1]
	
	l1.each{|v1|
		l2.each{|v2|
			vs << [v1, v2]
		}
	}
end
puts vs.length
vs.each{|v1, v2|
	puts "#{v1}, #{v2}"
}
