#include using namespace std; using lint = long long; int main() { int n; cin >> n; vector a(2 * n), b(2 * n); for (int i = 0; i < 2 * n; i++) { cin >> a[i]; } for (int i = 0; i < 2 * n; i++) { cin >> b[i]; } vector> p; for (int i = 0; i < 2 * n; i++) { p.emplace_back(a[i] + b[i], i); } sort(p.begin(), p.end()); lint x = 0, y = 0; for (int i = 0; i < 2 * n; i++) { int id = p[i].second; if (i % 2 == 0) { x += a[id]; } else { y += b[id]; } } cout << x - y << endl; }