#include<bits/stdc++.h>
using namespace std;
#define int long long
#define inf 0x3f3f3f3f3f3f3f3f

const int N=4e5+5;

inline int read()
{
	int x=0,f=1;
	char c=getchar();
	while(c<'0'||c>'9')
	{
	    if(c=='-')
	        f=-1;
	    c=getchar();
	}
	while(c>='0'&&c<='9')
	{
	    x=x*10+c-'0';
	    c=getchar();
	}
	return x*f;
}

int n;
int a[N],b[N],c[N],re[N],val[N],len=0;
inline int Find(int x)
{
	return lower_bound(re+1,re+len+1,x)-re;
}

int tree[N];
inline int lowbit(int x)
{
	return x&(-x);
}
inline void add(int place,int c)
{
	for(int i=place;i<=len;i+=lowbit(i))
		tree[i]=min(tree[i],c);
}
inline int ask(int place)
{
	int ans=inf;
	for(int i=place;i;i-=lowbit(i))
		ans=min(ans,tree[i]);
	return ans;
}

int Ans=0;
struct node{
	int c1,c2,val;
}re1[N],re2[N];
inline bool cmp1(node x,node y)
{
	return x.c1<y.c1;
}
inline bool cmp2(node x,node y)
{
	return x.c1>y.c1;
}
inline void Work1()
{
	for(int i=1;i<=n;i++) re1[i].c1=a[i], re1[i].c2=b[i], re1[i].val=-re[a[i]]-re[b[i]]-val[i];
	for(int i=1;i<=n;i++) re2[i].c1=b[i], re2[i].c2=a[i], re2[i].val=re[a[i]]+re[b[i]]-val[i];
	sort(re1+1,re1+n+1,cmp1); sort(re2+1,re2+n+1,cmp1); 
	int p1=1,p2=1; memset(tree,0x3f3f3f3f,sizeof(tree));
	while(p1<=n || p2<=n)
	{
		if(p2>n || (p1<=n && re1[p1].c1<=re2[p2].c1)) add(re1[p1].c2,re1[p1].val), p1++;
		else Ans=min(Ans,ask(re2[p2].c2)+re2[p2].val), p2++;
	}
}
inline void Work2()
{
	for(int i=1;i<=n;i++) re1[i].c1=a[i], re1[i].c2=b[i], re1[i].val=-re[a[i]]+re[b[i]]-val[i];
	for(int i=1;i<=n;i++) re2[i].c1=b[i], re2[i].c2=a[i], re2[i].val=re[b[i]]-re[a[i]]-val[i];
	sort(re1+1,re1+n+1,cmp1); sort(re2+1,re2+n+1,cmp1); 
	int p1=1,p2=1; memset(tree,0x3f3f3f3f,sizeof(tree));
	while(p1<=n || p2<=n)
	{
		if(p2>n || (p1<=n && re1[p1].c1<=re2[p2].c1)) add(len-re1[p1].c2+1,re1[p1].val), p1++;
		else Ans=min(Ans,ask(len-re2[p2].c2+1)+re2[p2].val), p2++;
	}
}
inline void Work3()
{
	for(int i=1;i<=n;i++) re1[i].c1=a[i], re1[i].c2=b[i], re1[i].val=re[a[i]]-re[b[i]]-val[i];
	for(int i=1;i<=n;i++) re2[i].c1=b[i], re2[i].c2=a[i], re2[i].val=-re[b[i]]+re[a[i]]-val[i];
	sort(re1+1,re1+n+1,cmp2); sort(re2+1,re2+n+1,cmp2); 
	int p1=1,p2=1; memset(tree,0x3f3f3f3f,sizeof(tree));
	while(p1<=n || p2<=n)
	{
		if(p2>n || (p1<=n && re1[p1].c1>=re2[p2].c1)) add(re1[p1].c2,re1[p1].val), p1++;
		else Ans=min(Ans,ask(re2[p2].c2)+re2[p2].val), p2++;
	}
}
inline void Work4()
{
	for(int i=1;i<=n;i++) re1[i].c1=a[i], re1[i].c2=b[i], re1[i].val=re[a[i]]+re[b[i]]-val[i];
	for(int i=1;i<=n;i++) re2[i].c1=b[i], re2[i].c2=a[i], re2[i].val=-re[b[i]]-re[a[i]]-val[i];
	sort(re1+1,re1+n+1,cmp2); sort(re2+1,re2+n+1,cmp2); 
	int p1=1,p2=1; memset(tree,0x3f3f3f3f,sizeof(tree));
	while(p1<=n || p2<=n)
	{
		if(p2>n || (p1<=n && re1[p1].c1>=re2[p2].c1)) add(len-re1[p1].c2+1,re1[p1].val), p1++;
		else Ans=min(Ans,ask(len-re2[p2].c2+1)+re2[p2].val), p2++;
	}
}

signed main()
{
	n=read(); int tot=0,sum=0;
	for(int i=1;i<=n;i++) a[i]=read(), c[++tot]=a[i];
	for(int i=1;i<=n;i++) b[i]=read(), c[++tot]=b[i], sum+=abs(a[i]-b[i]), val[i]=abs(a[i]-b[i]);
	c[0]=-1; sort(c+1,c+tot+1);
	for(int i=1;i<=tot;i++)
		if(c[i]!=c[i-1])
			re[++len]=c[i];
	for(int i=1;i<=n;i++) a[i]=Find(a[i]), b[i]=Find(b[i]);
	Work1(); Work2(); Work3(); Work4();
	printf("%lld\n",sum+Ans);
    return 0;
}