#include <bits/stdc++.h>
using namespace std;
int x[100001], y[100001];
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 = max(ymax, y[i]);
  }
  return !printf("%d\n", min(xmax - xmin, ymax - ymin));
}
