#include <iostream>
#include <math.h>
using namespace std;
int x[2010], y[2010];
int p;
int main()
{
	int k;
	cin >> k;
	int j = 0;
	p = 0;
	while(k > 0)
	{
		int t = max(3, (int)cbrt(6*k));
		k -= t * (t-1) * (t-2) / 6;
		for(int xc = 0; xc < t; xc++, p++) x[p] = xc, y[p] = j;
		j += j + 1;
	}
	cout << p << "\n";
	for(int i = 0; i < p; i++) cout << x[i] << " " << y[i] << "\n";
}