#include <iostream>

using namespace std;

int main () {
	
	int brojacx = 0, brojacy = 0, kordx[2000], kordy[2000], brojac = 0, N, f;
	
	cin >> N;
	
	f = 1037836800;
	
	for (int i = 13; i >= 3; i--) {
		
		while (N >= f) {
			
			N -= f;
			
			for (int l = 0; l < i; l++) {
				
				kordx[brojac] = brojacx;
				kordy[brojac] = brojacy;
				
				brojac++;
				brojacx++;
				
			}
			
			brojacy++;
			brojacx += brojac;
			
		}	
		
		f = f / i;
		
	}
	
	cout << brojac << endl; 
	
	for (int i = 0; i < brojac; i++) {
		
		cout << kordx[i] << " " << kordy[i] << endl;
		
	}
	
	return 0;
	
	}