#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long int
// #define ll long long int
#define ld long double
#define ff first
#define ss second
#define mp make_pair
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define pb push_back
#define eb emplace_back
#define pii pair<int, int>
#define endl '\n'
#define all(x) x.begin(),x.end()
#define f(i,j,l) for(i=j;i<l;i++)
#define smax(a,b) a=max(a,b)
// #if !defined(ONLINE_JUDGE)
// #include "debugging.h"
// #endif
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
// find_by_order(k)  returns iterator to kth element starting from 0;
// order_of_key(k) returns count of elements strictly smaller than k;
// erase,insert same as normal set

// int const mod = 7340033;
// int const mod = 998244353;
long long const mod = 1e9+7;
int power(int a,int b,int m){
    int res = 1;
    while(b){
        if(b&1){
            // res = res*a;
            res = (res*a)%m;
        }
        a=(a*a)%m;
        // a%=m;
        b=b/2;
    }
    return res;
}

int inverse(int x , int m){
    return power(x,m-2,m);
}


int const N = 2e5+5;
int const inf = 1e18;

int seg[2][4*N];

void build(int in,int l,int r){
    if(l==r){
        seg[0][in] = seg[1][in] = -inf;
        return ;
    }
    int mid = (l+r)/2;
    build(2*in,l,mid);
    build(2*in+1,mid+1,r);
    seg[0][in] = max(seg[0][2*in] , seg[0][2*in+1]);
    seg[1][in] = max(seg[1][2*in], seg[1][2*in+1]);
}

void update(int in,int l,int r,int t,int x,int val){
	// propagate(in,l,r);
	if(x<l || x>r){
		return;
	}
	if(l == r && l == x){
        seg[t][in] = max(seg[t][in] , val);
		return ;
	}
	int mid = (l+r)/2;
	update(2*in,l,mid,t,x,val);
	update(2*in+1,mid+1,r,t,x,val);
	seg[t][in] = max(seg[t][2*in+1] , seg[t][2*in]);
}

int query(int in,int l,int r,int t,int lt,int rt){
	// propagate(in,l,r);
	if(rt<l || lt>r) return -inf;
	if(l>=lt && r<=rt){
		return seg[t][in];
	}
	int mid = (l+r)/2;
	if(rt<=mid) return query(2*in,l,mid,t,lt,rt);
	else if(lt > mid) return query(2*in+1,mid+1,r,t,lt,rt);
	else{
		int p,q;
		p = query(2*in,l,mid,t,lt,mid);
		q = query(2*in+1,mid+1,r,t,lt,rt);
		return max(p,q);
	}
}

void solve(){
    int i,j;
    int n;
    cin>>n;
    set<int> st;
    map<int, int> m1;

    vector<pii> v;

    for(i=0;i<n;i++){
        int x,y;
        cin>>x>>y;
        v.push_back({x,y});
        st.insert(y);
    }
    sort(all(v));
    j = 1;
    for(auto x:st){
        m1[x] = j;
        j++;
    }
    int mx = j-1;

    build(1,1,mx);
    int ans = -inf;
    for(i=0;i<v.size();i++){
        int x,y;
        x = v[i].first;
        y = v[i].second;
        {
            int z = x + y;
            int q = query(1,1,mx,0,1,m1[y]);
            ans = max(ans , z+q);
        }
        {
            int z = x - y;
            int q = query(1,1,mx,1,m1[y]+1,mx);
            ans = max(ans , z+q);
        }

        update(1,1,mx,0,m1[y],-x-y);
        update(1,1,mx,1,m1[y],-x+y);
    }

    cout<<ans<<endl;
}   


int32_t main(){
    IOS;
    int t;
    t = 1;
    // precompute();
    // cin>>t;  
    for(int tt=1;tt<=t;tt++){
        // cout << "Case #"<<tt<<": ";
        solve();
    }
    return 0;
}

/* 

x1,y1  x2,y2

x2-x1 + (y2-y1)|(y1-y2)

-x1-y1
-x1+y1


x2+y2 
x2-y2

*/

Measured memory_bytes: 36380