#include <cstdio>
#include <algorithm>
#include <stack>
#include <queue>
#include <deque>
#include <vector>
#include <string>
#include <string.h>
#include <cstdlib>
#include <ctime>
#include <cmath>
#include <map>
#include <set>
#include <iostream>
#include <sstream>
#include <numeric>
#include <cctype>
#include <bitset>
#include <cassert>
#include <random>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define gep(i,g,j) for(int i = g.head[j]; i != -1; i = g.e[i].next)
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcount
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define df(x) int x = in()
#define dame { puts("-1"); return 0;}
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,vector<T>,greater<T> >
#define bn(x) ((1<<x)-1)
#define newline puts("")
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
inline void priv(vi a) { rep(i,sz(a)) printf("%d%c",a[i],i==sz(a)-1?'\n':' ');}
template<typename T>istream& operator>>(istream&i,vector<T>&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(vector<T>&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>ostream& operator<<(ostream&o,vector<T>&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>ostream& operator<<(ostream&o,pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
const int MX = 100005, INF = 1001001001;
const ll LINF = 1e18;
const double eps = 1e-10;

// coordinate compression
struct X {
  typedef int T;
  vector<T> d;
  inline void add(T x) { d.pb(x);}
  void init() {
    sort(rng(d));
    d.erase(unique(rng(d)), d.end());
  }
  inline int size() { return sz(d);}
  inline int operator[](T x) { return upper_bound(rng(d),x)-d.begin()-1;}
};
//

// Segment tree (RMQ type)
vi used, q;
vector<P> ps;
struct seg {
  vector<vi> d; int x2;
  vi e;
  seg(){}
  seg(int mx) {
    x2 = 1; while (x2 < mx) x2 <<= 1;
    d.resize(x2<<1); e.resize(x2<<1);
  }
  void fil() {
    drep(i,x2) {
      d[i] = d[i<<1];
      d[i].insert(d[i].end(), rng(d[i<<1|1]));
    }
  }
  void add(int i, int x=0){
    i += x2;
    d[i].pb(x);
  }
  void get(int a, int b, int x) { return get(a,b,x,1,0,x2);}
  void get(int a, int b, int x, int i, int l, int r){
    if (a <= l && r <= b) {
      q.pb(-sz(ps));
      ps.pb(P(i,x));
      return;
    }
    int c = (l+r)>>1;
    if (a < c) get(a,b,x,i<<1,l,c);
    if (c < b) get(a,b,x,i<<1|1,c,r);
  }
};
//


int n;
vi a;

bool f(int x) {
  int m = n*2;
  X xs;
  rep(j,3) {
    int di = j-1;
    rep(i,m) xs.add(a[i] +di);
    rep(i,m) xs.add(a[i]-x+1 +di);
    rep(i,m) xs.add(a[i]+x +di);
  }
  xs.init();
  vi vs;
  {
    seg d(sz(xs)+3);
    rep(i,m) {
      d.add(xs[a[i]],i^1);
    }
    d.fil();
    used = vi(m);
    q = vi();
    ps = vp(1);
    rep(i,m) if (!used[i]) {
      q.pb(i);
      while (sz(q)) {
        int v = q.back(); q.pop_back();
        // cout<<v<<" : "<<q<<endl;
        if (v >= m) {
          vs.pb(v-m);
          continue;
        }
        if (v < 0) {
          v = -v;
          int di = ps[v].fi, x = ps[v].se;
          int& ei = d.e[di];
          bool ok = true;
          while (ei < sz(d.d[di])) {
            if (used[d.d[di][ei]]) ++ei;
            else if (d.d[di][ei] == (x^1)) {
              if (ei == sz(d.d[di])-1) {
                ok = false;
                break;
              }
              ++ei; d.d[di].pb(x^1);
            } else break;
          }
          if (!ok) continue;
          if (ei == sz(d.d[di])) continue;
          q.pb(-v);
          q.pb(d.d[di][ei++]);
          continue;
        }
        if (used[v]) continue;
        used[v] = 1;
        q.pb(m+v);
        d.get(xs[a[v]-x+1],xs[a[v]+x],v);
      }
      // cout<<vs<<endl;
    }
  }
  reverse(rng(vs));
  {
    seg d(sz(xs)+3);
    rep(i,m) {
      d.add(xs[a[i]],i);
    }
    d.fil();
    used = vi(m);
    q = vi();
    ps = vp(1);
    int ui = 1;
    for (int i : vs) if (!used[i]) {
      q.pb(i);
      while (sz(q)) {
        int v = q.back(); q.pop_back();
        if (v < 0) {
          v = -v;
          int di = ps[v].fi, x = ps[v].se;
          int& ei = d.e[di];
          bool ok = true;
          while (ei < sz(d.d[di])) {
            if (used[d.d[di][ei]]) ++ei;
            else if (d.d[di][ei] == (x^1)) {
              if (ei == sz(d.d[di])-1) {
                ok = false;
                break;
              }
              ++ei; d.d[di].pb(x^1);
            } else break;
          }
          if (!ok) continue;
          if (ei == sz(d.d[di])) continue;
          q.pb(-v);
          q.pb(d.d[di][ei++]);
          continue;
        }
        if (used[v]) continue;
        used[v] = ui;
        d.get(xs[a[v^1]-x+1],xs[a[v^1]+x],v);
      }
      ++ui;
    }
    // cout<<used<<endl;
  }
  rep(i,m) if (used[i] == used[i^1]) return false;
  return true;
}

int main() {
  scanf("%d",&n);
  a = vi(n*2);
  rep(i,n*2) scanf("%d",&a[i]);
  // cout<<f(3)<<endl; return 0;
  int l = 0, r = INF;
  while (l+1<r) {
    int c = (l+r)>>1;
    if (f(c)) l = c; else r = c;
  }
  cout<<l<<endl;
  return 0;
}






















Measured memory_bytes: 29024