#include <bits/stdc++.h>
using namespace std;
int n, A[1000001], B[1000001];
int main() {
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);
int k = 2e9;
for (int i = 1, j = n; i <= n; i++) {
while (j > 0 && A[i] + B[j] > 0) k = min(k, A[i] + B[j]), j--;
if (j > 0) k = min(k, -(A[i] + B[j]));
}
cout << k;
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CmludCBuLCBBWzEwMDAwMDFdLCBCWzEwMDAwMDFdOwppbnQgbWFpbigpIHsKICAgIGNpbiA+PiBuOwogICAgZm9yIChpbnQgaSA9IDE7IGkgPD0gbjsgaSsrKSBjaW4gPj4gQVtpXTsKICAgIGZvciAoaW50IGkgPSAxOyBpIDw9IG47IGkrKykgY2luID4+IEJbaV07CiAgICBzb3J0KEEgKyAxLCBBICsgbiArIDEpOwogICAgc29ydChCICsgMSwgQiArIG4gKyAxKTsKICAgIGludCBrID0gMmU5OwogICAgZm9yIChpbnQgaSA9IDEsIGogPSBuOyBpIDw9IG47IGkrKykgewogICAgICAgIHdoaWxlIChqID4gMCAmJiBBW2ldICsgQltqXSA+IDApIGsgPSBtaW4oaywgQVtpXSArIEJbal0pLCBqLS07CiAgICAgICAgaWYgKGogPiAwKSBrID0gbWluKGssIC0oQVtpXSArIEJbal0pKTsKICAgIH0KICAgIGNvdXQgPDwgazsKICAgIHJldHVybiAwOwp9