#include <iostream>
#include <string>

using namespace std;

int nad(int n) {
	return n * (n - 1) * (n - 2) / 6;
}

int invers(int n) {
	int nb = 0;
	while (n > 0) {
		nb *= 10;
		nb += n % 10;
		n /= 10; 
	}
	return nb;
}

string con(int n) {
	n = invers(n);
	string s = "";
	char ch;
	while (n > 0) {
		ch = n % 10 + '0';
		n /= 10;
		s += ch;
	}
	return s;
}

int main() {
	int k, p = 0, m = 0;
	string ispis[1000];
	cin >> k;
	int n;
	if (k == 1) {
		cout << 3 <<endl;
		cout << 0 << " " << 1 << endl;
		cout << 0 << " " << 2 << endl;
		cout << 0 << " " << 3 << endl;
	}
	else if (k == 2) {
		cout << 5 <<endl;
		cout << 0 << " " << 1 << endl;
		cout << 0 << " " << 2 << endl;
		cout << 0 << " " << 3 << endl;
		cout << 1 << " " << 2 << endl;
		cout << 2 << " " << 2 << endl;
	}
	else if (k == 3) {
		cout << 6 <<endl;
		cout << 0 << " " << 1 << endl;
		cout << 0 << " " << 2 << endl;
		cout << 0 << " " << 3 << endl;
		cout << 1 << " " << 3 << endl;
		cout << 2 << " " << 3 << endl;
		cout << 2 << " " << 2 << endl;
	}
	else {
		int pom = 0, i;
		int pom2 = 1;
		while (k >= 4) {
			n = 4;
			while (nad(n) <= k) {
				n++;
			}
			n--;
			for (i = 0; i < n; i++) {
				ispis[p] = con(pom2) + " " + con(i+pom);
				p++;
			}
			pom = i;
			pom2+=3;
			k -= nad(n);
		}
		if (k == 1) {
			ispis[p] = con(pom2) + " " + con(pom);
			ispis[p+1] = con(pom2) + " " + con(pom+1);
			ispis[p+2] = con(pom2) + " " + con(pom+2);
			p += 3;
		}
		if (k == 2) {
			ispis[p] = con(pom2) + " " + con(pom);
			ispis[p+1] = con(pom2) + " " + con(pom+1);
			ispis[p+2] = con(pom2) + " " + con(pom+2);
			ispis[p+3] = con(pom2+1) + " " + con(pom+2);
			ispis[p+4] = con(pom2+2) + " " + con(pom+2);
			p += 5;
		}
		if (k == 3) {
			ispis[p] = con(pom2) + " " + con(pom);
			ispis[p+1] = con(pom2) + " " + con(pom+1);
			ispis[p+2] = con(pom2) + " " + con(pom+2);
			ispis[p+3] = con(pom2+1) + " " + con(pom+2);
			ispis[p+4] = con(pom2+2) + " " + con(pom+2);
			ispis[p+5] = con(pom2+1) + " " + con(pom+1);
			p += 6;
		}
		cout << p << endl;
		for (i = 0; i < p; i++) {
			if (ispis[i] == "1 ") cout << 1 << " " << 0 << endl;
			else cout << ispis[i] << endl;
		}
	}
	return 0;
}