#include<iostream>
#include<vector>
using namespace std;
int N; vector<pair<int, int>>P;
int main() {
	cin >> N;
	for (int i = 1; i <= N; i++) {
		for (int j = 1; j <= N; j++) {
			if (((i % 2 == 1 && j % 6 == 4) || (i % 2 == 0 && j % 6 == 1) || i == 1 || i == N || j == N) && (i + j) % 2 == 1)P.push_back(make_pair(i, j));
		}
	}
	cout << P.size() << endl;
	for (int i = 0; i < P.size(); i++)cout << P[i].first - 1 << ' ' << P[i].second - 1 << endl;
	return 0;
}