#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
constexpr int INF = 1e9 + 7;
 
#define sz(x) ((int)(x).size())
#define pb push_back
#define all(s) s.begin(), s.end()
#define f first
#define s second
 
const int N = 1e6 + 6;
 
ll sil[N];
ll odw[N];
 
ll fast(ll a, ll b){
    ll ret = 1;
 
    while(b){
        if(b & 1)
            ret = ret * a % INF;
        a = a * a % INF;
        b /= 2;
    }
 
    return ret;
}
 
map<ll, int> mapa;
 
void solve() {
    int n; cin >> n;
 
    vi A(n), B(n);
 
    vector<pair<int, int> > a;
    vector<pair<int, int> > b;
 
    for(int i = 0; i < n; i++)
        cin >> A[i];
 
    ll wynik = 0;
    for(int i = 0; i < n; i++){
        cin >> B[i];
        wynik += abs(A[i] - B[i]);
 
        if(A[i] >= B[i])
            a.pb({A[i], B[i]});
        else
            b.pb({B[i], A[i]});
    }
 
    sort(all(a));
    sort(all(b));
 
    int oszcz = 0;
 
    for(int i = 0; i < 2; i++){        
        int id_a = sz(a) - 1;
        int id_b = sz(b) - 1;
 
        set<int> secik;
 
        while(id_a >= 0){
            while(id_b >= 0 and a[id_a].f <= b[id_b].f){
                secik.insert(b[id_b].s);
                id_b--;
            }
            if(sz(secik))
                oszcz = max(oszcz, 2 * (a[id_a].f - max(a[id_a].s, *secik.begin())));
            id_a--;
        }
 
        swap(a, b);
    }
 
    cout << wynik - oszcz << '\n';
}
 
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
 
    int tt = 1;
    // cin >> tt;
    
    for(int i = 0; i < tt; i++)
        solve();
}
