#include <bits/stdc++.h>
#define i64 long long
#define sz(a) int((a).size())
#define all(a) a.cbegin(), a.cend()
#define rep(i, a, b) for (register int i = (a); i < (b); ++i)
#define per(i, a, b) for (register int i = (b) - 1; i >= (a); --i)
using namespace std;

const int Nbuf = 1 << 20;
char ibuf[Nbuf], *sib = ibuf, *tib = ibuf;
// #define Gc() getchar()
#define Gc() (sib == tib and (tib = (sib = ibuf) + \
 fread(ibuf, 1, Nbuf, stdin), sib == tib) ? EOF : *sib++)
template<class item> void read(item &x) {
	bool f = false; x = 0; char c = Gc();
	for (; c < '0' or c > '9'; c = Gc()) {if (c == '-') {f ^= 1;}}
	for (; '0' <= c and c <= '9'; c = Gc()) {x = x * 10 + (c ^ 48);}
	if (f) {x = 0 - x;}
}

const int N = 2e5;
struct par {int x, y; bool r;};
par a[N]; int n, f[2];

int main() {
	read(n); i64 res = 0; int md = 0;
	rep(i, 0, n) {read(a[i].x);}
	rep(i, 0, n) {read(a[i].y);}
	rep(i, 0, n) {
		par &p = a[i];
		if ((p.r = p.x > p.y)) {swap(p.x, p.y);}
		res += p.y - p.x;
	}
	sort(a, a + n, [&](par &p, par &q) {return p.x < q.x;});
	rep(i, 0, n) {
		const par &p = a[i];
		f[p.r] = max<int>(f[p.r], p.y);
		md = max<int>(md, min<int>(p.y, f[!p.r]) - p.x);
	}
	cout << res - 2 * md << '\n';
	return 0;
}

/* 📌https://www.cnblogs.com/George1123/p/tips.html */