#include using namespace std; #define rep(i, n) for(int i=0; i<(n); ++i) #define REP(i, d, n) for(int i=(d); i<(n); ++i) #define all(v) v.begin(), v.end() using ll = long long; using P = pair; int main() { int n; cin >> n; vector a(2*n); rep(i, 2*n){ cin >> a[i]; } int right = 0, left = 2*n-1; ll homura = 0, tempra = 0; rep(i, n){ if(a[right] > a[left]){ homura += a[right++]; tempra += a[right++]; } else{ homura += a[left--]; tempra += a[left--]; } } cout << homura - tempra << endl; return 0; }