#include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <stack>
#include <iomanip>


using namespace std;

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define REPO(i, n) for(int i = 1;i <= n;i++)
#define ll long long
#define INF 1999999999
#define MINF -1999999999
#define INF64 1999999999999999999
#define ALL(n) n.begin(),n.end()
#define MOD 1000000007


ll n;
vector<pair<ll, ll>> s;
int main() {
	cin >> n;
	REP(i, n) {
		if (i % 3 == 0 or i == 0 or i == n - 1) {
			REP(j, n)if ((i + j) % 2 == 1)s.push_back(make_pair(j, i));
		}
		else if (i % 2 == 1) s.push_back(make_pair(0, i));
	}
	cout << s.size() << endl;
	REP(i, s.size()) cout << s[i].first << " " << s[i].second << endl;
}