#include <iostream>
#include <vector>
#include <cmath>
#include <climits>
#include <algorithm>
#define MAX_N 2000
using namespace std;

struct Point
{
    int a;
    int b;
    vector<pair<int, int>> susedi;
} ;
int table[MAX_N][MAX_N];
vector <Point> tochki;
bool visited[MAX_N];
int deikstra(int start, int n)
{
    int mini;
    int j;
    fill_n(visited, n, false);
    visited[start]=true;
    int maxl=0;
    while(true)
    {
        mini=INT_MAX;
        j=-1;
        for(int i=0; i<n; i++)
        {
            if(mini>table[start][i] && visited[i]==false)
            {
                mini=table[start][i];
                j=i;
            }
        }
        if(j==-1 || mini==INT_MAX)
        {
            break;
        }
        if(maxl<mini)
        {
            maxl=mini;
        }
        visited[j]=true;
        //cout << "****" << j << endl;
        for(int i=0; i<tochki[j].susedi.size(); i++)
        {
            //cout << tochki[j].susedi[i].first << endl;
            if(!visited[tochki[j].susedi[i].first])
            {
                if(tochki[j].susedi[i].second+mini<table[start][tochki[j].susedi[i].first])
                {
                    table[start][tochki[j].susedi[i].first]=tochki[j].susedi[i].second+mini;
                    if(maxl<table[start][tochki[j].susedi[i].first])
                    {
                        maxl=table[start][tochki[j].susedi[i].first];
                    }
                }
            }
        }
    }

    for(int i=0; i<n; i++)
    {
        table[i][start]=table[start][i];
    }
    return maxl;
}


int main()
{
    int n;
    cin >> n;
    tochki.resize(n);
    int x, y;
    int r;
    for(int i=0; i<n; i++)
    {
        cin >> x >> y;
        tochki[i].a=x;
        tochki[i].b=y;
        for(int j=0; j<i; j++)
        {
            r=INT_MAX;
            if(tochki[j].a==x)
            {
                r=max(tochki[j].b,y)-min(tochki[j].b, y) + max(tochki[j].a, x)-min(tochki[j].a, x);
                tochki[j].susedi.push_back({i, r});
                tochki[i].susedi.push_back({j, r});
            }
            else if(tochki[j].b==y)
            {
                r=max(tochki[j].a, x)-min(tochki[j].a, x) + max(tochki[j].b,y)-min(tochki[j].b, y);
                tochki[j].susedi.push_back({i, r});
                tochki[i].susedi.push_back({j, r});
            }
            table[i][j]=r;
            table[j][i]=r;

        }
    }
    int Max=0;
    int currMax=0;

    for(int i=0; i<n; i++)
    {
        currMax=deikstra(i, n);
        //cout << currMax << endl;
        if(currMax>Max)
        {
            Max=currMax;
        }
        //cout << i << endl;

        //cout << "*******" << endl;
    }

    cout << Max;



    return 0;
}
