// ba mei zi !

#include<bits/stdc++.h>

#define HEAP priority_queue
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define per(i, n) for(int i = (n) - 1; i >= 0 ; --i)
#define forn(i, l, r) for(int i = (l); i <= (r); ++i)
#define nrof(i, r, l) for(int i = (r); i >= (l); --i)
#define FOR(a, b) for(auto (a): (b))
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define X first
#define Y second
#define eps 1e-6
#define pi 3.1415926535897932384626433832795
#define SZ(x) (int)x.size()
#define ALL(x) x.begin(), x.end()
#define FILL(a, b) memset((a), (b), sizeof((a)))
#define MCPY(a, b) memcpy((a), (b), sizeof((b)))

using namespace std;

typedef long long LL;
typedef double flt;
typedef vector<int> vi;
typedef vector<LL> vl;
typedef pair<int,int> pii;
typedef pair<int,LL> pil;
typedef pair<LL,int> pli;
typedef pair<LL,LL> pll;
typedef vector<pil> vil;
typedef vector<pii> vii;
typedef vector<pli> vli;
typedef vector<pll> vll;

const int iinf = 1e9+7;
const LL linf = 1ll<<60;
const flt dinf = 1e60;

template <typename T>
inline void scf(T &x)
{
	bool f = 0; x = 0; char c = getchar();
	while((c < '0' || c > '9') && c != '-') c = getchar();
	if(c == '-') { f = 1; c = getchar(); }
	while(c >= '0' && c <= '9') { x = x * 10 + c - '0'; c = getchar(); }
	if(f) x = -x; return;
}

template <typename T1, typename T2>
void scf(T1 &x, T2 &y) { scf(x); return scf(y); }

template <typename T1, typename T2, typename T3>
void scf(T1 &x, T2 &y, T3 &z) { scf(x); scf(y); return scf(z); }

template <typename T1, typename T2, typename T3, typename T4>
void scf(T1 &x, T2 &y, T3 &z, T4 &w) { scf(x); scf(y); scf(z); return scf(w); }

inline char mygetchar(){ char c = getchar(); while(c == ' ' || c == '\n') c = getchar(); return c; }

template <typename T>
void chkmax(T &x, const T &y){ if(y > x) x = y; return; }

template <typename T>
void chkmin(T &x, const T &y){ if(y < x) x = y; return; }

#ifdef ONLINE_JUDGE
#define debug(x,c) ;
#else
#define DEBUG
#define debug(x,c) cerr<<#x<<"="<<x<<c;
#endif

#undef DEBUG

//---------------------------head----------------------------

const int N = 2e4 + 100;

int n;
int pos[N], chs[N];
int rnk[N], id[N];
bool vis[N];

namespace BIT_vis
{
    int num[N];
    void init(){ FILL(num, 0); }
    inline int lowbit(int i){ return i & (-i); }
    inline void modify(int i, int x)
    {
        for(; i <= n; i += lowbit(i)) num[i] += x;
        return;
    }
    inline int query(int i)
    {
        int ret = 0;
        for(; i; i ^= lowbit(i)) ret += num[i];
        return ret;
    }
}

namespace BIT_chs
{
    int num[N];
    void init(){ FILL(num, 0); }
    inline int lowbit(int i){ return i & (-i); }
    inline void modify(int i, int x)
    {
        for(; i <= n; i += lowbit(i)) num[i] += x;
        return;
    }
    inline int query(int i)
    {
        int ret = 0;
        for(; i; i ^= lowbit(i)) ret += num[i];
        return ret;
    }
}

void MEI()
{
    int tot = 0;
    map<int, int> M; M.clear();

    scf(n); n <<= 1;
    rep(i, n)
    {
        scf(pos[i]);
        if(M.find(pos[i]) == M.end()) M[pos[i]] = 0;
        ++M[pos[i]];
    }

    for(auto it = M.begin(); it != M.end(); ++it) tot += it -> Y, it -> Y = tot;

    rep(i, n)
    {
        id[M[pos[i]]] = i;
        rnk[i] = M[pos[i]];
        M[pos[i]]--;
    }
    return;
}

vi pool_chs, pool_vis;
int MID;

inline int find_nxt()
{
    int lb = 1, rb = n;
    while(lb <= rb)
    {
        int mid = lb + rb >> 1;
        if(BIT_vis::query(mid) < mid) rb = mid - 1;
        else lb = mid + 1;
    }
    return lb;
}

inline int get_l(int i)
{
    int LB = pos[id[i]] - MID;
    int lb = 1, rb = n;
    while(lb <= rb)
    {
        int mid = lb + rb >> 1;
        int x = pos[id[mid]];
        if(x <= LB) lb = mid + 1;
        else rb = mid - 1;
    }
    return lb;
}

inline int get_r(int i)
{
    int RB = pos[id[i]] + MID;
    int lb = 1, rb = n;
    while(lb <= rb)
    {
        int mid = lb + rb >> 1;
        int x = pos[id[mid]];
        if(x >= RB) rb = mid - 1;
        else lb = mid + 1;
    }
    return rb;
}

inline int find_l(int i)
{
    int sum = BIT_vis::query(i);
    int lb = 1, rb = i - 1;
    while(lb <= rb)
    {
        int mid = lb + rb >> 1;
        int x = BIT_vis::query(mid - 1);
        if(sum - x == (i - mid + 1)) rb = mid - 1;
        else lb = mid + 1;
    }
    return rb;
}

inline int find_r(int i)
{
    int sum = BIT_vis::query(i - 1);
    int lb = i + 1, rb = n;
    while(lb <= rb)
    {
        int mid = lb + rb >> 1;
        int x = BIT_vis::query(mid);
        if(x - sum == (mid - i + 1)) lb = mid + 1;
        else rb = mid - 1;
    }
    return lb;
}

inline bool chk(int i)
{
    #ifdef DEBUG
    printf("\t%d %d:\n\t", i, rnk[id[i] ^ 1]);
    forn(i, 1, n) cout<<chs[i]<<' '; cout<<endl<<'\t';
    forn(i, 1, n) cout<<vis[i]<<' '; cout<<endl;
    #endif // DEBUG
    if(chs[i]) return 1;

    int j = rnk[id[i] ^ 1];
    chs[i] = 1;
    BIT_chs::modify(i, 1);
    pool_chs.pb(i);

    int li = get_l(i), ri = get_r(i);

    #ifdef DEBUG
    cout<<"\t\t"<<li<<' '<<ri<<endl<<endl;
    #endif // DEBUG

    if(BIT_chs::query(ri) - BIT_chs::query(li - 1) > 1) return 0;

    vis[i] = vis[j] = 1;
    BIT_vis::modify(i, 1); BIT_vis::modify(j, 1);
    pool_vis.pb(i); pool_vis.pb(j);

    j = find_l(i);
    while(j >= li)
    {
        if(!chk(rnk[id[j] ^ 1])) return 0;
        j = find_l(j);
    }

    j = find_r(i);
    while(j <= ri)
    {
        if(!chk(rnk[id[j] ^ 1])) return 0;
        j = find_r(j);
    }

    return 1;
}

bool check(int mid)
{
    #ifdef DEBUG
    puts("=====================================================================");
    debug(mid, '\n')
    #endif // DEBUG
    MID = mid;
    FILL(vis, 0); FILL(chs, 0);
    BIT_vis::init(); BIT_chs::init();
    for(;;)
    {
        int i = find_nxt();
        if(i > n) return 1;

        pool_chs.clear();
        pool_vis.clear();

        if(!chk(i))
        {
            for(int i: pool_chs) BIT_chs::modify(i, -1), chs[i] = 0;
            for(int i: pool_vis) BIT_vis::modify(i, -1), vis[i] = 0;

            pool_chs.clear();
            pool_vis.clear();
            i = rnk[id[i] ^ 1];
            if(!chk(i)) return 0;
        }
    }
}

void ZI()
{
    int lb = 0, rb = (pos[id[n]] - pos[id[1]]) / (n / 2 - 1);
    #ifdef DEBUG
    forn(i, 1, n) cout<<id[i]<<' '; cout<<endl;
    rep(i, n) cout<<rnk[i]<<' '; cout<<endl;
    cout<<rb<<endl;
    #endif // DEBUG
    while(lb <= rb)
    {
        int mid = lb + rb >> 1;
        if(check(mid)) lb = mid + 1;
        else rb = mid - 1;
    }
    printf("%d\n", rb);
    return;
}

/*
Main
code
is
over
.
If
you
are
in
a
hurry
trying
to
hack
me
you
don't
need
to
read
the
part
left
.
Trust
me
.
It
is
useless
.
My
code
always
gets
a
failed
system
test
,
so
it
will
be
pretty
easy
for
you
to
hack
me
.
Just
find
a
test
case
and
hack
.
Wish
you
all
happy
hack
.
 _____
/     \
| . . |
|     |
|  |  |
| --- |
| \_/ |
\_____/

*/

#ifdef DEBUG
struct I{ int x; I(){} I(int y):x(y){} bool operator <(const I &a) const{ return x < a.x; }};

pair<I,LL> time_limit_exceeded;
const bool FLAG = 1;
static vector<I> wrong_answer;
I *RP=new I;

I FUCK=min(I{*RP}, I{0});
static int memory_limit_exceeded[10];
vi O(){cout<<FUCK.x<<endl; vi ert; int x=0;
x=(int)hypot(3.0, 4.0); ert.pb(x);
if(x&1)exit(0);
auto t=lower_bound(ALL(ert), 5);
static list<int> runtime_error_;
return ert;}
#endif // DEBUG

#define MEI int
#define ZI main
MEI ZI()
{
#undef MEI
#undef ZI

    MEI();
    ZI();

#define BA return
#define MEI 0
#define ZI ;
BA MEI ZI
#undef BA
#undef MEI
#undef ZI
}


Measured memory_bytes: 1664