#include<bits/stdc++.h>
using namespace std;
typedef double db;
typedef uint32_t u32;
typedef uint64_t u64;
typedef pair<int, int> pii;
typedef pair<int, int> point;
#define fi first
#define se second
#define pb(x) push_back(x)
#define SZ(x) ((int) (x).size())
#define all(x) (x).begin(), (x).end()
#define rep(i, l, r) for(int i = l; i < r; i++)
typedef long long ll;
const int mod = 998244353;



int main() {
#ifdef local
	freopen("in.txt", "r", stdin);
#endif
	ios::sync_with_stdio(false);
	cin.tie(0), cout.tie(0);
	const int mod = 1e9 + 7;
	int n;
	cin >> n;
	vector<pii> p(n);
	vector<int> d;
	for(auto &e : p) {
		cin >> e.fi;
		d.push_back(e.fi);
	}
	for(auto &e : p) {
		cin >> e.se;
		d.push_back(e.se);
	}
	sort(all(d));
	d.erase(unique(all(d)), d.end());
	auto h = [&](int x) {
		return lower_bound(all(d), x) - d.begin() + 1;
	};
	int L = d.size();
	vector<int> b(L + 1);
	auto update = [&](int x, int v) {
		for(; x <= L; x += x&-x) b[x] = max(b[x], v);
	};
	auto query = [&](int x) {
		int ret = 0;
		for(; x > 0; x -= x&-x) ret = max(ret, b[x]);
		return ret;
	};

	sort(all(p));
	ll ans = 0;
	for(int i = 0; i < n; i++) {
		if(p[i].fi >= p[i].se) {
			int t = query(h(p[i].se));
			ans = max<ll>((min(t, p[i].fi) - p[i].se) * 2, ans);
		}
		if(p[i].fi <= p[i].se) {
			update(h(p[i].fi), p[i].se);
		}
	}
	for(auto &e : p) swap(e.fi, e.se);
	sort(all(p));
	fill(all(b), 0);
	for(int i = 0; i < n; i++) {
		if(p[i].fi >= p[i].se) {
			int t = query(h(p[i].se));
			ans = max<ll>((min(t, p[i].fi) - p[i].se) * 2, ans);
		}
		if(p[i].fi <= p[i].se) {
			update(h(p[i].fi), p[i].se);
		}
	}
	ans = -ans;
	for(auto &e : p) ans += abs(e.fi - e.se);
	cout << ans << '\n';
	return 0;
}
