#include <iostream>
#include <fstream>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <cstring>
#include <string>
#include <cmath>
#include <cassert>
#include <ctime>
#include <algorithm>
#include <sstream>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <cstdlib>
#include <cstdio>
#include <iterator>
#include <functional>
#include <bitset>
#include <iomanip>
#include <float.h>
#include <numeric>
#define _USE_MATH_DEFINES
#include <math.h>

#define ll long long

#define FOR(i,a,b)        for(ll i=(a);i<(b);i++)
#define REP(i,n)        FOR(i,0,n)
#define SORT(v)            sort((v).begin(),(v).end())
#define UN(v)            SORT(v),(v).erase(unique((v).begin(),(v).end()),(v).end())
#define CL(a,b)            memset(a,b,sizeof a)
#define pb                push_back


#ifndef M_PI
    #define M_PI 3.14159265358979323846
#endif

using namespace std;

ll denom = 1e9+7;//998244353;
ll powmod(ll a,ll b) {ll res=1;a%=denom; for(;b;b>>=1){if(b&1)res=res*a%denom;a=a*a%denom;}return res;}

int main(int argc, const char * argv[])
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    ll t =1;// cin >> t;
    while (t-- > 0) {
        ll n; cin >> n;
        vector<ll> a(n); REP(i, n) cin >> a[i];
        vector<ll> b(n); REP(i, n) cin >> b[i];
        ll sum = 0;
        map<ll, ll> m1, m2;
        REP(i, n) {
            sum += abs(a[i]-b[i]);
            if (a[i] < b[i]) {
                m1[a[i]] = max(m1[a[i]], b[i]);
            } else {
                m2[b[i]] = max(m2[b[i]], a[i]);
            }
        }
        
        ll mx = INT_MIN;
        for(auto &x: m1) {
            mx = max(mx, x.second);
            x.second = mx;
        }

        mx = INT_MIN;
        for(auto &x: m2) {
            mx = max(mx, x.second);
            x.second = mx;
        }
        
        
        ll d = 0;
        REP(i, n) {
            if (a[i] < b[i]) {
                auto it = m2.upper_bound(a[i]);
                if (it == m2.begin()) continue;
                it--;
                
                ll overlap = min(it->second, b[i]) - a[i];
                d = max(d, 2*overlap);
                
            } else {
                auto it = m1.upper_bound(b[i]);
                if(it==m1.begin()) continue;

                it--;
                ll overlap = min(it->second,a[i]) - b[i];
                d = max(d, 2*overlap);
            }
        }
        cout << sum - d << endl;
    }
    
    return 0;
}


