#include <bits/stdc++.h>
using namespace std;

int n, x[2004], y[2004], answer;
int path[2004][2004];
const int inf = 1000000000;

int main () {
ios_base::sync_with_stdio(false);
cin.tie(0); cout.tie(0);

cin >> n;

for (int i=0; i < n; i++) {
    cin >> x[i] >> y[i];
}

for (int i=0; i < n; i++) {
    for (int j=0; j < n; j++) {
        path[i][j] = inf;
    }
}

for (int i=0; i < n; i++) {
    for (int j=0; j < n; j++) {
        if (x[i] == x[j] or y[i] == y[j]) {
            path[i][j] = abs(x[i] - x[j]) + abs(y[i] - y[j]);
        }
    }
}

for (int k=0; k < n; k++) {
    for (int i=0; i < n; i++) {
        for (int j=0; j < n; j++) {
            if (path[i][k] + path[k][j] < path[i][j]) {
                path[i][j] = path[i][k] + path[k][j];
            }
        }
    }
}

for (int i=0; i < n; i++) {
    for (int j=0; j < n; j++) {
        if (path[i][j] == inf) {continue;}
        //cout << i << " " << j << " " << path[i][j] << endl;
        answer = max (answer, path[i][j]);
    }
}

cout << answer << endl;

return 0;
}
