//#pragma GCC optimize("O3")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("avx2")
// 293206GT
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <unordered_set>
#include <stack>
#include <string>
#include<algorithm>
#include <random>
#include <bitset>
#include <chrono>

typedef long long ll;
#define int ll
using namespace std;
#define put(a) cout << (a) << '\n'
#define sqr(x) (x) * (x)
typedef pair<int, int> pii;
typedef long double ld;
typedef pair<ld, ld> pld;
typedef unsigned long long ull;

typedef vector<int> vi;
typedef vector<pii> vpii;
#define rep(x, y, a) for (int x = (y); x < (int)(a); ++x)
#define all(a) a.begin(), a.end()
#define chkmax(a, b) a = max(a, (b))
#define chkmin(a, b) a = min(a, (b))
#define prev asasdasd
#define next aasdasda
#define left asdasdasdasd
#define right asnabsdkasdl
#define rank asdasdknlasd
#define move asdasdas

namespace IO {

    template<class A, class B>
    ostream &operator<<(ostream &out, vector<pair<A, B>> a);

    template<class A>
    ostream &operator<<(ostream &out, vector<A> a);

    template<class A, class B>
    ostream &operator<<(ostream &out, pair<A, B> a) {
        out << a.first << " " << a.second;
        return out;
    }

    template<class A, class B>
    ostream &operator<<(ostream &out, vector<pair<A, B>> a) {
        for (pair<A, B> x: a)
            out << x.first << " " << x.second << '\n';
        return out;
    }

    template<class A>
    ostream &operator<<(ostream &out, vector<A> a) {
        for (A x: a) out << x << ' ';
        return out;
    }

    template<class A, class B>
    istream &operator>>(istream &in, pair<A, B> &a) {
        in >> a.first >> a.second;
        return in;
    }

    template<class A>
    istream &operator>>(istream &in, vector<A> &a) {
        for (A &x: a) in >> x;
        return in;
    }
}
using namespace IO;


mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int INF = 1e10;
struct segtree_max {
    vi t;
    int n;
    void build() {  // build the tree
        for (int i = n - 1; i > 0; --i) t[i] = max(t[i<<1], t[i<<1|1]);
    }
    segtree_max(vi a) {
        n = a.size();
        t.resize(n * 2);
        rep(i, 0, n) t[i + n] = a[i];
        build();
    }
    void modify(int p, int value) {  // set value at position p
        for (t[p += n] = value; p > 1; p >>= 1) t[p>>1] = max(t[p], t[p^1]);
    }

    int query(int l, int r) {  // sum on interval [l, r)
        int res = -INF;
        for (l += n, r += n; l < r; l >>= 1, r >>= 1) {
            if (l&1) chkmax(res, t[l++]);
            if (r&1) chkmax(res, t[--r]);
        }
        return res;
    }
};
vi b;
int get(int x) {
    return lower_bound(all(b), x) - b.begin();
}
void solve() {
    int n;
    cin >> n;
    vpii a(n);
    cin >> a;
    b = vi(n);
    sort(all(a));
    rep(i, 0, n)b[i] = a[i].second;
    sort(all(b));
    vector<map<int, int>> c1(n);
    vector<map<int, int>> c2(n);
    rep(i, 0, n) {
        ++c1[get(a[i].second)][a[i].first + a[i].second];
        ++c2[get(a[i].second)][a[i].first - a[i].second];
    }
    vi d1(n), d2(n);
    rep(i, 0, n) {
        d1[i] = (c1[i].size()==0?-INF:c1[i].rbegin()->first);
        d2[i] = (c2[i].size()==0?-INF:c2[i].rbegin()->first);
    }
    segtree_max e1(d1), e2(d2);
    int ans = 0;
    rep(i, 0, n) {
        chkmax(ans, -a[i].first + a[i].second + e2.query(0, get(a[i].second) + 1));
        chkmax(ans, -a[i].first - a[i].second + e1.query(get(a[i].second), n));
        if(--c1[get(a[i].second)][a[i].first + a[i].second] == 0) c1[get(a[i].second)].erase(a[i].first + a[i].second);
        if(--c2[get(a[i].second)][a[i].first - a[i].second] == 0) c2[get(a[i].second)].erase(a[i].first - a[i].second);
        d1[i] = (c1[i].size()==0?-INF:c1[i].rbegin()->first);
        d2[i] = (c2[i].size()==0?-INF:c2[i].rbegin()->first);
        e1.modify(i, d1[i]);
        e2.modify(i, d2[i]);
    }
    put(ans);
}


signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cout.precision(30);
//    freopen("input.txt", "r", stdin);
    int q = 1;
//    cin >> q;

    while (q--) solve();
}


Measured memory_bytes: 52648