#include <bits/stdc++.h>
#include <chrono>
#include <random>
#define ll long long
#define ld long double
#define R return
//#define B break
#define C continue
#define sf scanf
#define pf printf
#define pb push_back
#define F first
#define S second

using namespace std;

const ll Mod=1e9+7;

ll poww(ll a,ll b,ll mod){
    ll res=1;if(b<0)b=(b%(mod-1)+mod-1)%(mod-1);
    for(;b;b>>=1,a=1ll*a*a%mod)
      if(b&1)res=1ll*res*a%mod;
    return res;
}

void Max(ll& x,ll y){
x=max(x,y);
}
void Min(ll& x,ll y){
x=min(x,y);
}

void OK(bool yes){
if(yes){
    cout<<"YES"<<'\n';

}
else{
    cout<<"NO"<<'\n';
}
}

const ll N=200200,LN=(1<<24),K=21,Mx=3e5,Inf=4e18;
const ld pi=acos(-1);

int a[N],b[N];
vector<pair<int,int>> v1,v2,vec1,vec2;
vector<int> pos;

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    //mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

    ll T=1;
    //cin>>T;
    while(T--){
        int n;
        ll Ans=0;
        cin>>n;
        for(int i=1;i<=n;i++){
            cin>>a[i];
        }
        for(int i=1;i<=n;i++){
            cin>>b[i];
            Ans+=abs(a[i]-b[i]);
        }
        //cout<<Ans<<'\n';
        for(int i=1;i<=n;i++){
            if(a[i]<b[i])v1.pb({a[i],b[i]});
            else if(a[i]>b[i])v2.pb({b[i],a[i]});
        }
        if(v1.empty()||v2.empty()){
            cout<<Ans<<'\n';
            return 0;
        }
        sort(v1.begin(),v1.end());
        sort(v2.begin(),v2.end());
        vec1.pb(v1[0]);
        vec2.pb(v2[0]);
        for(int i=1;i<v1.size();i++){
            if(v1[i].S<=vec1.back().S)continue;
            vec1.pb(v1[i]);
        }
        for(int i=1;i<v2.size();i++){
            if(v2[i].S<=vec2.back().S)continue;
            vec2.pb(v2[i]);
            pos.pb(v2[i].S);
        }
        ll mx=0;
        for(int i=0;i<vec1.size();i++){
            ll p=lower_bound(pos.begin(),pos.end(),vec1[i].F)-pos.begin();
            for(int j=p;j<vec2.size();j++){
                if(vec2[j].S<vec1[i].F)continue;
                if(vec2[j].F>vec1[i].S)break;
                if(i+1<vec1.size()){
                    if(vec2[j].F>=vec1[i+1].F)break;
                }
                Max(mx,min(vec1[i].S,vec2[j].S)-max(vec1[i].F,vec2[j].F));
            }
        }
        Ans-=2*mx;
        cout<<Ans<<'\n';
    }


    return 0;
}
