#include <iostream>
#include <vector>
#include <string>
#include <array>
#include <functional>
#include <algorithm>
#include <stack>
#include <map>
#include <set>
#include <climits>
#include <queue>
#include <bitset>
#include <cassert>
#include <math.h>
#include <complex>
#include <iomanip>
#include <unordered_map>
using namespace std;
#define ll long long
#define pb(x) push_back(x)
#ifdef _OLIMPOLOCAL
    #define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
    #define debug(...) 1337
#endif
void debug_out() { cout << "\n";}
template<typename T1, typename... T2> void debug_out(T1 A, T2... B) { cout << " " << A; debug_out(B...); }
int test = 1;
#define out(x) {cout << x << "\n";return;}
#define all(N) N.begin(),N.end()
#define allr(N) N.rbegin(),N.rend()
template<typename T1> 
void pr(vector<T1> V, int add = 0, int start = -1, int end = -1) {
    if (start < 0) start = 0;
    if (end < 0) end = V.size() - 1;
    for (int i = start; i <= end; i++) {
        cout << V[i] + add << ((i == end) ? "\n" : " ");
    }
}
template<typename T1> 
T1 chmin(T1 &x, const T1 v) { return x = min(x,v); }
template<typename T1> 
T1 chmax(T1 &x, const T1 v) { return x = max(x,v); }

#define rep(i, n) for (int i = 0; i < n; i++)
#define reps(i, s, n) for (int i = s; i < n; i++)
#define repr(i, n) for (int i = n-1; i >= 0; i--)
#define repsr(i, s, n) for (int i = n-1; i >= s; i--)
#define PI pair<int,int>
template<typename T1> 
T1 gcd(const T1 &a, const T1 &b) {
    if (a == 0 || b == 0) return a + b;
    return gcd(b, a %b);
}
//-------------------------- ^ DONT TOUCH ^-----------------------------------------------------------------
#define MAX 100001 
#define MOD 1000000007ll
int n;

void solve() {
    cin >> n;
    vector<int> N(n+n);    
    ll s = 0;
    rep(i,n + n) {
        cin >> N[i];
        s += N[i];
    }
    ll b = 0;
    priority_queue<int> Q;
    rep(i, n) {
        Q.push(-N[n-i-1]);
        Q.push(-N[n+i]);
        b += Q.top();
        Q.pop();
    }
    out(s+b);
}
int main() {

    ios_base::sync_with_stdio(0);cin.tie(0);
#ifdef _OLIMPOLOCAL     
    cin >> test;
#endif
    
    rep(testCase, test) {
        #ifdef _OLIMPOLOCAL
        cout << "Case #" << testCase + 1 << "\n";
        #endif
        solve();
    }
    return 0;
}
#include <bits/stdc++.h>
#define endl '\n'

#define SZ(x) ((int)x.size())
#define ALL(V) V.begin(), V.end()
#define L_B lower_bound
#define U_B upper_bound
#define pb push_back

using namespace std;
template<class T, class T1> int chkmin(T &x, const T1 &y) { return x > y ? x = y, 1 : 0; }
template<class T, class T1> int chkmax(T &x, const T1 &y) { return x < y ? x = y, 1 : 0; }
const int MAXN = (1 << 20);

int n;
int a[MAXN];
int64_t sum = 0;

void read() {
	cin >> n;
	for(int i = 0; i < 2 * n; i++) {
		cin >> a[i];
		sum += a[i];
	}
}

void solve() {
	int r = 2 * n - 1;
	int64_t ans = 0;
	priority_queue<int> q;
	for(int i = n; i < 2 * n; i++) {
		ans += a[i];
	}

	for(int i = 0; i < n; i++) {
		q.push(a[r--]);
		if(q.top() > a[i]) {
			ans -= q.top();
			ans += a[i];
			q.pop();
			q.push(a[i]);
		}
	}

	cout << sum - ans << endl;
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);

	read();
	solve();
	return 0;
}

