#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];
set<pair<ll,ll>> best;
/*
void dijkstra(ll start_node){
    while(!best.empty()){
        pair<ll,ll> curr_node=*best.begin();
        best.erase(curr_node);
        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];
            if(visited[next_node.first]){
                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]});
            }else{

            }
        }

    }
}
*/
void solve(){
    ll n;
    cin>>n;
    for(ll i=0;i<n;i++){
        cin>>a[i]>>b[i];
    }
    ll ans=0;
    for(ll i=0;i<n;i++){
        for(ll j=i+1;j<n;j++){
            if(a[i]==a[j] or b[i]==b[j]){
                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])});
                ans=max(ans,abs(a[i]-a[j])+abs(b[i]-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);
    }
    */
    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;
}
