#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define fi first
#define se second
#define pii pair<int, int>
const int MAX = 2e3 + 10;
int n, m;
int mat[MAX][MAX];
int smjer[8][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}, {1, 1}, {1, -1}, {-1, 1}, {-1, -1}};
vector <pii> v = {{1, 2}, {2, 4}, {1, 3}, {2, 1}, {2, 2}, {3, 4}, {1, 4}, {3, 1}, {3, 2}, {3, 3}, {4, 1}, {4, 3}, {4, 2}, {4, 4}};
vector <pii> v2 = {{2, 3}, {3, 1}, {2, 2}, {1, 1}, {3, 3}, {3, 2}, {1, 2}, {1, 3}, {2, 1}};
vector <pii> par = {{0, 2}, {0, 1}, {1, 2}, {1, 0}, {2, 0}, {1, 1}, {2, 1}, {2, 2}};
vector <pii> nep = {{1, 2}, {0, 1}, {2, 1}, {1, 1}, {0, 2}, {2, 0}, {1, 0}, {2, 2}};
bool moguce(int x, int y) {
int cnt = 0;
for (int i = 0; i < 8; i++) {
int x2 = x;
int y2 = y;
while (x2 >= 1 && x2 <= m && y2 >= 1 && y2 <= m) {
if (mat[x2][y2]) cnt++;
x2 += smjer[i][0];
y2 += smjer[i][1];
}
}
if (cnt % 2 == 0) return true;
return false;
}
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cin >> n;
if (n <= 2) {
cout << "1\n1 1\n";
return 0;
}
if (n % 2 == 0) {
cout << n * n - 2 << "\n";
for (int i = 0; i < 14; i++) {
cout << v[i].fi << " " << v[i].se << "\n";
mat[v[i].fi][v[i].se] = 1;
}
}
else {
cout << n * n << "\n";
for (int i = 0; i < 9; i++) {
cout << v2[i].fi << " " << v2[i].se << "\n";
mat[v2[i].fi][v2[i].se] = 1;
}
}
int bla = 4;
if (n % 2 == 0) bla = 5;
m = n;
for (int i = bla; i <= n; i += 2) {
m += 2;
for (int j = 1; j <= i - 2; j++) {
if (moguce(i, j)) {
cout << i << " " << j << "\n";
cout << i + 1 << " " << j << "\n";
}
else {
cout << i + 1 << " " << j << "\n";
cout << i << " " << j << "\n";
}
mat[i][j] = 1;
mat[i + 1][j] = 1;
if (moguce(j, i)) {
cout << j << " " << i << "\n";
cout << j << " " << i + 1 << "\n";
}
else {
cout << j << " " << i + 1 << "\n";
cout << j << " " << i << "\n";
}
mat[j][i] = 1;
mat[j][i + 1] = 1;
}
if (n % 2 == 0) {
for (auto e : par) {
int x = e.fi + i - 1;
int y = e.se + i - 1;
mat[x][y] = 1;
cout << x << " " << y << "\n";
}
}
else {
for (auto e : nep) {
int x = e.fi + i - 1;
int y = e.se + i - 1;
mat[x][y] = 1;
cout << x << " " << y << "\n";
}
}
}
return 0;
}