#include<bits/stdc++.h>

using namespace std;

#define rep(x, L, R) for(int x = (L), _x = (R); x <= _x; x++)
#define per(x, R, L) for(int x = (R), _x = (L); x >= _x; x--)
#define broken fprintf(stderr, "running on %s %d\n", __FUNCTION__, __LINE__)
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define SZ(v) (int)(v).size()
#define ALL(x) (x).begin(), (x).end()
#define x first
#define y second
#define mp make_pair
#define pb push_back

template<typename T> inline bool ckmin(T &a, const T &b) { return b < a ? a = b, 1 : 0; }
template<typename T> inline bool ckmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; }

typedef pair<int, int> par;
typedef long long LL;
typedef unsigned long long uLL;
typedef double db;
const int N = 2e5 + 10;
int n, l[N], r[N];
par b[N], s[N];

int main() {
	scanf("%d", &n);
	for(int i = 1; i <= n; i++) scanf("%d", &l[i]);
	for(int i = 1; i <= n; i++) scanf("%d", &r[i]);
	LL ans = 0;
	int tb = 0, ts = 0;
	for(int i = 1; i <= n; i++) {
		ans += abs(l[i] - r[i]);
		if(l[i] > r[i]) b[++tb] = mp(l[i], r[i]);
		else s[++ts] = mp(r[i], l[i]);
	}
	sort(b + 1, b + tb + 1);
	sort(s + 1, s + ts + 1);
	int now = tb + 1;
	int mx = 0, left = 0x3f3f3f3f, oleft = 0x3f3f3f3f;
	for(int i = ts; i >= 1; i--) {
		while(now - 1 >= 1 && b[now - 1].x >= s[i].x) {
			now--, left = min(left, b[now].y);
			mx = max(mx, b[now].x - max(b[now].y, oleft));
		}
		oleft = min(oleft, s[i].y);
		mx = max(mx, s[i].x - max(s[i].y, left));
	}
	while(now - 1 >= 1) {
		now--, left = min(left, b[now].y);
		mx = max(mx, b[now].x - max(b[now].y, oleft));
	}	
	printf("%lld\n", ans - mx * 2);
	return 0;
}


