$k=<>;
$d=31;
while($k){
	if($k&1){
		push@m,"1 $d\n";
	}
	--$d;
	$k>>=1;
}
for$a(2..31){
	for$b($a+1..32){
		push@m,"$a $b\n";
	}
}
print "32 ".@m."\n",@m;