#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;

const ll Size=2e3+1;
ll a[Size],b[Size];
ll path[Size][Size];
vector<pair<ll,ll>> adj[Size];
bool visited[Size];
set<ll> x[Size],y[Size];
set<pair<ll,ll>> best;
/*
void dijkstra(ll start_node){
    while(!best.empty()){
        pair<ll,ll> curr_node=*best.begin();
        while(visited[curr_node.second]){
            best.erase(curr_node);
            curr_node=*best.begin();
        }
        best.erase(curr_node);
        if(curr_node.first==1e18)
            break;
        path[start_node][curr_node.second]=curr_node.first;
        visited[curr_node.second]=1;
        for(ll i=0;i<adj[curr_node.second].size();i++){
            pair<ll,ll> next_node=adj[curr_node.second][i];
            best.erase({path[start_node][next_node.first],next_node.second});
            path[start_node][next_node.first]=min(path[start_node][next_node.first],path[start_node][curr_node.second]+next_node.second);
            best.insert({path[start_node][next_node.first],next_node.second});
        }

    }
}
*/
void solve(){
    ll n;
    cin>>n;
    for(ll i=0;i<n;i++){
        cin>>a[i]>>b[i];
        x[a[i]].insert(i);
        y[b[i]].insert(i);
    }
    for(ll i=0;i<n;i++){
        for(ll j=0;j<n;j++){
            path[i][j]=1e18;
        }
    }
    for(ll i=0;i<n;i++){
        for(auto j:x[a[i]]){
            if(j==i)
                continue;
                    /*
                adj[i].push_back({j,abs(a[i]-a[j])+abs(b[i]-b[j])});
                adj[j].push_back({i,abs(a[i]-a[j])+abs(b[i]-b[j])});
                */
            path[i][j]=abs(a[i]-a[j])+abs(b[i]-b[j]);
            for(auto k:y[b[j]]){
                if(k==j)
                    continue;
                path[i][k]=min(path[i][k],path[i][j]+abs(a[k]-a[j])+abs(b[k]-b[j]));
            }
        }
    }
    /*
    for(ll i=0;i<n;i++){
        best.clear();
        for(ll j=0;j<n;j++){
            if(j==i){
                best.insert({0,j});
            }else{
                best.insert({1e18,j});
            }
        }
        dijkstra(i);
    }

    for(ll i=0;i<n;i++){
        for(ll j=0;j<n;j++){
            cout<<path[i][j]<<" ";
        }
        cout<<endl;
    }
    */
    ll ans=0;
    for(ll i=0;i<n;i++){
        for(ll j=0;j<n;j++){
            if(path[i][j]!=1e18)
                ans=max(ans,path[i][j]);
        }
    }
    cout<<ans<<endl;
}

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll t=1;
    while(t--){
        solve();
    }
    return 0;
}
