#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

#define MAX 100001
int x[MAX], y[MAX];

int main(void) {
    int N, xmin = int(1e9), xmax = 0, ymin = int(1e9), ymax = 0;
    scanf("%d", &N);
    for(int i = 0; i < N; i++) {
        scanf("%d%d", x+i, y+i);
        xmin = min(xmin, x[i]);
        xmax = max(xmax, x[i]);
        ymin = min(ymin, y[i]);
        ymax = man(ymax, y[i]);
    }

    return !printf("%d\n", min(xmax - xmin, ymax - ymin));
}