//#include <windows.h>
//#include <psapi.h>
#include <bits/stdc++.h>
using namespace std;
#define pii pair<int, int>
#define LI (s * 2 + 1)
#define RI (s * 2 + 2)
#define LST (l)
#define LEN ((l + r) / 2)
#define RST ((l + r) / 2 + 1)
#define REN (r)
#define ASZ (r - l + 1)
#define LSZ (LEN - LST + 1)
#define RSZ (REN - RST + 1)
struct Pt { int x, y; };
int b1(Pt p) { return + p.y; }
int b2(Pt p) { return + p.y - p.x; }
int b3(Pt p) { return - p.x; }
int b4(Pt p) { return - p.x - p.y; }
int c1(Pt p) { return + p.x - p.y; }
int c2(Pt p) { return + p.x; }
int c3(Pt p) { return + p.x + p.y; }
int c4(Pt p) { return + p.y; }
int d1(Pt p) { return + p.x + p.y; }
int d2(Pt p) { return + p.x + p.y; }
int d3(Pt p) { return - p.x + p.y; }
int d4(Pt p) { return - p.x + p.y; }
int (* bv[])(Pt p) = {b1, b2, b3, b4};
int (* cv[])(Pt p) = {c1, c2, c3, c4};
int (* dv[])(Pt p) = {d1, d2, d3, d4};
vector<Pt> v;
int cmp1(const void* _a, const void* _b) {
Pt a = v[*(int*)_a];
Pt b = v[*(int*)_b];
int ca = b1(a);
int cb = b1(b);
if (ca < cb) {
return -1;
}
else if (ca > cb) {
return 1;
}
else {
return 0;
}
}
int cmp2(const void* _a, const void* _b) {
Pt a = v[*(int*)_a];
Pt b = v[*(int*)_b];
int ca = b2(a);
int cb = b2(b);
if (ca < cb) {
return -1;
}
else if (ca > cb) {
return 1;
}
else {
return 0;
}
}
int cmp3(const void* _a, const void* _b) {
Pt a = v[*(int*)_a];
Pt b = v[*(int*)_b];
int ca = b3(a);
int cb = b3(b);
if (ca < cb) {
return -1;
}
else if (ca > cb) {
return 1;
}
else {
return 0;
}
}
int cmp4(const void* _a, const void* _b) {
Pt a = v[*(int*)_a];
Pt b = v[*(int*)_b];
int ca = b4(a);
int cb = b4(b);
if (ca < cb) {
return -1;
}
else if (ca > cb) {
return 1;
}
else {
return 0;
}
}
int (* cmpv[])(const void*, const void*) = {cmp1, cmp2, cmp3, cmp4};
int dist(Pt a, Pt b) { return abs(a.x - b.x) + abs(a.y - b.y); }
char* pi = new char[10000000];
char* pi0 = pi;
unsigned int ru() {
while (!isdigit(*pi)) {
pi++;
}
int r = 0;
while (isdigit(*pi)) {
r *= 10;
r += *pi - '0';
pi++;
}
return r;
}
int main() {
fread(pi, 10000000, 1, stdin);
// fread(pi, 10000000, 1, fopen("be2.txt", "r"));
int N = ru();
v.resize(N);
vector<int> w(N);
vector<int> u(N);
vector<array<int, 4>> y(N);
vector<vector<int>> st(N * 4);
for (int i = 0; i < N; i++) {
v[i].x = ru();
v[i].y = ru();
}
delete pi0;
iota(w.begin(), w.end(), 0);
for (int q = 0; q < 4; q++) {
qsort(w.data(), w.size(), sizeof(int), cmpv[q]);
fill(u.begin(), u.end(), -1);
function<void(int, int, int)> seg = [&](int s, int l, int r) {
if (l == r) {
st[s] = {w[l]};
return;
}
seg(LI, LST, LEN);
seg(RI, RST, REN);
st[s].resize(ASZ);
int i = 0, j = 0, k = 0, m = -1;
while (j < LSZ && k < RSZ) {
int aj = st[LI][j];
int ak = st[RI][k];
if (cv[q](v[aj]) > cv[q](v[ak])) {
if (m != -1 && (u[aj] == -1 || dv[q](v[m]) < dv[q](v[u[aj]]))) {
u[aj] = m;
}
st[s][i] = aj;
j++;
}
else {
if (m == -1 || dv[q](v[ak]) < dv[q](v[m])) {
m = ak;
}
st[s][i] = ak;
k++;
}
i++;
}
while (j < LSZ) {
int aj = st[LI][j];
if (m != -1 && (u[aj] == -1 || dv[q](v[m]) < dv[q](v[u[aj]]))) {
u[aj] = m;
}
st[s][i] = aj;
j++;
i++;
}
while (k < RSZ) {
st[s][i] = st[RI][k];
k++;
i++;
}
};
seg(0, 0, N - 1);
for (int j = 0; j < N; j++) {
y[j][q] = u[j];
}
}
w.clear();
u.clear();
st.clear();
vector<vector<int>> g(N);
for (int i = 0; i < N; i++) {
g[i].reserve(8);
}
for (int i = 0; i < N; i++) {
for (int j = 0; j < 4; j++) {
int k = y[i][j];
if (k != -1) {
g[i].push_back(k);
g[k].push_back(i);
}
}
}
y.clear();
int ans = 0;
vector<bool> vis(N);
priority_queue<pii, vector<pii>, greater<pii>> pq;
pq.push({0, 0});
while (!pq.empty()) {
pii a = pq.top();
pq.pop();
if (vis[a.second]) {
continue;
}
vis[a.second] = true;
ans = max(ans, a.first);
for (int i : g[a.second]) {
if (!vis[i]) {
pq.push({dist(v[a.second], v[i]), i});
}
}
}
cout << ans << endl;
// PROCESS_MEMORY_COUNTERS_EX pmc;
// GetProcessMemoryInfo(GetCurrentProcess(), (PPROCESS_MEMORY_COUNTERS)&pmc, sizeof(pmc));
// cout << pmc.PeakPagefileUsage << endl;
return 0;
}