#include <bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
using namespace std;
const int N = 2e5 + 5; 

vector <int> open[2 * N];
vector <int> close[2 * N];
vector <int> org;

pair <int, int> a[N];

int n;

int getpos(int x) {
	return lower_bound(org.begin(), org.end(), x) - org.begin() + 1;
}

int solve() {
	multiset <int> f,g;
	for (int i = 1; i <= n; i++) {
		org.push_back(a[i].fi);
		org.push_back(a[i].se);
	}
	sort(org.begin(), org.end());
	org.resize(unique(org.begin(), org.end()) - org.begin());

	for (int i = 1; i <= n; i++) {
		int l = getpos(a[i].fi);
		int r = getpos(a[i].se);
		if (l < r) {
			open[l].push_back(l);
			close[r].push_back(l);
		} else {
			open[r].push_back(-r);
			close[l].push_back(-r);
		}
	}
	int m = org.size();

	int res = 0;
	for (int i = 1; i <= m; i++) {
		for (int x : open[i]) 
			if (x > 0)
				f.insert(x);
			else 
				g.insert(-x);

		for (int l : close[i]) {
			int u;
			if (l > 0) {
				f.erase(f.find(l));
				if (!g.size())
					continue;
				u = *g.begin();
			} else {
				l *= -1;
				g.erase(g.find(l));
				if (!f.size()) 
					continue;
				u = *f.begin();
			}
			res = max(res, org[i - 1] - org[max(u, l) - 1]);
		}
	}
	return res;
}

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cin >> n;
	for (int i = 1; i <= n; i++) 
		cin >> a[i].fi;

	long long sum = 0;
	for (int i = 1; i <= n; i++)
		cin >> a[i].se, sum += abs(a[i].fi - a[i].se);

	cout << sum - 2 * solve();
	return 0;
}