#include <bits/stdc++.h>
using namespace std;
long long n,ma=1e9,a[1000006],b[1000006],x;
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    freopen("RBPOINT.inp","r",stdin);
    freopen("RBPOINT.out","w",stdout);
    cin>>n;
    for(int i=1;i<=n;i++) cin>>a[i];
    for(int i=1;i<=n;i++) cin>>b[i];
    sort(a+1,a+n+1);
    sort(b+1,b+n+1);
    b[n+1]=1e10;
    b[0]=-1e10;
    for(int i=1;i<=n;i++)
    {
        x=lower_bound(b+1,b+n+1,a[i])-b;
        ma=min({ma,abs(b[x]-a[i]),abs(a[i]-b[x-1])});
    }
    cout<<ma;
    return 0;
}
