#include <bits/stdc++.h>
#define endl "\n"
#pragma GCC optimize("Ofast")
using namespace std;
typedef long long ll;
const ll mod = 1e9 + 7;

const ll MAX_N = 2e3 + 10;
vector<ll> whox[MAX_N], whoy[MAX_N];
ll x[MAX_N], y[MAX_N];
ll n;
ll dist[MAX_N];
ll ans = 0;

ll mv(ll a, ll b) {
    return abs(x[a] - x[b]) + abs(y[a] - y[b]);
}

void dij(ll st) {
    for(ll i = 0; i < n; i ++) {
        dist[i] = mod;
    }
    priority_queue<pair<ll, ll> > pq;
    dist[st] = 0;
    pq.push({dist[st], st});

    while(!pq.empty()) {
        auto curr = pq.top(); pq.pop();

        curr.first *= -1;

        for(const auto it : whox[x[curr.second]]) {
            if(dist[it] > curr.first + mv(curr.second, it)) {
                dist[it] = curr.first + mv(curr.second, it);
                pq.push({-dist[it], it});
            }
        }

        for(const auto it : whoy[y[curr.second]]) {
            if(dist[it] > curr.first + mv(curr.second, it)) {
                dist[it] = curr.first + mv(curr.second, it);
                pq.push({-dist[it], it});
            }
        }
    }

    for(ll i = 0; i < n; i ++) {
        if(dist[i] == mod) { continue; }
        ans = max(ans, dist[i]);
    }
}

signed main() {
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

    cin >> n;
    for(ll i = 0; i < n; i ++) {
        cin >> x[i] >> y[i];
        whox[x[i]].push_back(i);
        whoy[y[i]].push_back(i);
    }


    for(ll i = 0; i < n; i ++) {
        dij(i);
    }
    cout << ans << endl;

    return 0;
}
