/** try <3 **/
#include<bits/stdc++.h>

using namespace std;

#define task "sol"
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define zs(v) ((int)(v).size())
#define BIT(x, i) (((x) >> (i)) & 1)
#define CNTBIT __builtin_popcountll
#define ALL(v) (v).begin(),(v).end()
#define endl '\n'

typedef long double ld;
typedef long long ll;
typedef pair<int,int> pii;

const int dx[8]={0,-1,0,1,1,-1,-1,1};
const int dy[8]={-1,0,1,0,-1,-1,1,1};

void gogo()
{
    string s;
    cin>>s;

    s=s+s[0];
    s.erase(0,1);

    cout<<s;
}
int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    if(fopen(task".inp","r"))
    {
        freopen(task".inp","r",stdin);
        freopen(task".out","w",stdout);
    }
    gogo();
}








#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template<class T> using vc = vector<T>;
template<class T> using vvc = vc<vc<T>>;
template<class T> using vvvc = vc<vvc<T>>;
template<class T> using vvvvc = vvc<vvc<T>>;
template<class T> using PQ = priority_queue<T>;
template<class T> using invPQ = priority_queue<T, vector<T>, greater<T>>;
using IP = pair<int, int>;
using LP = pair<ll, ll>;
#define mp make_pair
#define pb push_back
#define all(x) begin(x), end(x)
#define rep(i, n) for (int i = 0; (i) < (int)(n); i++)
#define rep3(i, m, n) for (int i = (m); (i) < (int)(n); i++)
#define repr(i, n) for (int i = n; (i) >= 0; i--)
#define rep3r(i, m, n) for (int i = (n); (i) >= (int)(m); i--)
template<class T> inline bool chmax(T & a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T & a, T b) { if (a > b) { a = b; return 1; } return 0; }
//constexpr int INF = 1070000000;
//constexpr long long LINF = 4611686015206162431;
//constexpr int MOD = 1000000007;

signed main() {
    ios::sync_with_stdio(0);
    cin.tie(0);

    int N;
    cin >> N;
    vc<int> V(N*2);
    rep (i, N*2) cin >> V[i];

    ll s = 0;
    rep (i, N*2) s += V[i];

    priority_queue<int, vc<int>, greater<int>> que;
    int l = N-1, r = N;

    rep (i, N) {
        que.push(V[l]);
        que.push(V[r]);
        s -= que.top();
        que.pop();
        l--; r++;
    }

    cout << s << endl;
}