#include <cstdio>
#include <algorithm>
#include <cmath>
#include <queue>
#include <vector>
#include <map>
#include <set>

using namespace std;

typedef pair<int , int> P2;
typedef pair<pair<int , int> , int> P3;
typedef pair<pair<int , int> , pair<int , int> > P4;
#define Fst first
#define Snd second
#define PB(a) push_back(a)
#define MP(a , b) make_pair((a) , (b))
#define M3P(a , b , c) make_pair(make_pair((a) , (b)) , (c))
#define M4P(a , b , c , d) make_pair(make_pair((a) , (b)) , make_pair((c) , (d)))
#define repp(i,a,b) for(int i = (int)(a) ; i < (int)(b) ; ++i)
#define repm(i,a,b) for(int i = (int)(a) ; i > (int)(b) ; --i)
#define repv(t,it,v) for(vector<t>::iterator it = v.begin() ; it != v.end() ; ++it)

int N;
int x[200010];
int y[200010];
int k;

int main(){
	scanf("%d" , &N);
	for(int i = 0 ; i * 3 < N - 1 ; ++i){
		for(int j = i % 2 ; j < N ; j += 2){
			x[k] = 3 * i + 1;
			y[k] = j;
			++k;
		}
	}
	if(N%3==1){
		for(int j = N % 2 ; j < N ; j += 2){
			x[k] = N-1;
			y[k] = j;
			++k;
		}
	}
	for(int i = 1 ; i * 3 - 1 < N ; ++i){
		x[k] = i * 3 - 1;
		y[k] = i%2;
		++k;
	}
	printf("%d\n" , k);
	repp(i,0,k){
		printf("%d %d\n" , x[i] , y[i]);
	}
	return 0;
}
