#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0, length = n; i < length; i++)
#define fi first
#define se second
#define lb lower_bound
#define ub upper_bound
#define ep emplace
#define epb emplace_back
#define scll static_cast<long long> 
#define sz(x) static_cast<int>((x).size())
#define pfll(x) printf("%lld\n", x)
#define ci(x) cin >> x
#define ci2(x, y) cin >> x >> y
#define ci3(x, y, z) cin >> x >> y >> z
#define ci4(w, x, y, z) cin >> w >> x >> y >> z
#define co(x) cout << x << endl
#define co2(x, y) cout << x << " " << y << endl
#define co3(x, y, z) cout << x << " " << y << " " << z << endl
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef priority_queue<int> PQ;
typedef priority_queue<int, vector<int>, greater<int>> PQG;
typedef priority_queue<P> PQP;
typedef priority_queue<P, vector<P>, greater<P>> PQPG;

const int MAX_N = 2e5, MOD = 1e9 + 7, INF = 1e9;
int n, v[2 * MAX_N];

int main() {
    ci(n);
    ll sum = 0, aoki = 0;
    rep(i, 2 * n) {
        ci(v[i]);
        sum += v[i];
    }
    PQG q;
    rep(i, n) {
        q.ep(v[n - i - 1]);
        q.ep(v[n + i]);
        aoki += q.top(); q.pop();
    }
    co(sum - aoki);
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define Pr pair<ll,ll>
#define Tp tuple<int,int,int>
using Graph = vector<vector<int>>;

int main(){
    ll N; cin >> N;
    ll v[2*N]; ll sum = 0,loss = 0;
    rep(i,2*N){
        cin >> v[i]; sum += v[i];
    }
    ll k1 = N-1; ll k2 = N;
    multiset<ll> mean;
    rep(i,N){
        mean.insert(v[k1]); mean.insert(v[k2]);
        auto itr = mean.begin();
        loss += *itr; mean.erase(itr);
        k1--; k2++;
    }
    cout << sum-loss << endl;
}