#include <cstdio>
#include <queue>
#include <string>
#include <cstring>
#include <algorithm>
#include <cstdlib>
#include <iostream>
#include <iomanip>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <fstream>
#include <cassert>
#include <complex>
#include <ctime>
//#include <tr1/unordered_map>
#include <bitset>
#define pii pair<int,int>
#define pdd pair<double,double>
#define pb push_back
#define fi first
#define se second
#define is insert
#define es erase
#define mkp make_pair
#define per(i,a,b) for(int i = a; i >= b; --i)
#define rep(i,a,b) for(int i = a; i <= b; ++i)
 
using namespace std;
//using namespace tr1;
typedef long long ll;
typedef unsigned long long ull;
 
inline int read()
{
    int x = 0;
    int f = 0;
    char ch = 0;
    while(!isdigit(ch))
    {
        f |= (ch == '-') ? 1 : 0;
        ch = getchar();
    }
    while(isdigit(ch))
    {
        x = (x << 3) + (x << 1) + (ch ^ 48);
        ch = getchar();
    }
    return f ? -x : x;
}
 
const int maxn = 2e5 + 15;
struct node
{
    int fi,se,typ;
}pp[maxn];
int n;
 
int cmp(node a,node b)
{
    if(a.fi != b.fi)
        return a.fi < b.fi;
    return a.se > b.se;
}
 
int main()
{
    n = read();
    int cnt0 = 0,cnt1 = 0;
    ll ans = 0;
    rep(i,1,n)
        pp[i].fi = read();
    rep(i,1,n)
        pp[i].se = read(),ans += abs(pp[i].first - pp[i].second);
    rep(i,1,n)
        if(pp[i].fi < pp[i].se)
            pp[i].typ = 0;
        else
            pp[i].typ = 1,swap(pp[i].first,pp[i].second);
    sort(pp + 1,pp + n + 1,cmp);
    int mx0 = 0,mx1 = 0;
    ll temp = 0;
    rep(i,1,n)
        if(!pp[i].typ)
        {
            ll tmp = max(0,min(mx1,pp[i].second) - pp[i].first);
            temp = max(temp,tmp);
            mx0 = max(mx0,pp[i].second);
        }
        else
        {
            ll tmp = max(0,min(mx0,pp[i].second) - pp[i].first);
            temp = max(temp,tmp);
            mx1 = max(mx1,pp[i].second);
        }
    printf("%lld",ans - temp * 2);
}