#include using namespace std; int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int n; cin >> n; vector a(n * 2), b(n * 2); for(int i = 0; i < n * 2; i++) cin >> a[i]; for(int i = 0; i < n * 2; i++) cin >> b[i]; vector> p(n * 2); for(int i = 0; i < n * 2; i++) p[i] = {a[i] + b[i], i}; sort(p.begin(), p.end()); long long ans = 0; for(int i = 0; i < 2 * n; i++){ int idx = p[i].second; if(i % 2 == 0){ ans += a[idx]; }else{ ans -= b[idx]; } } cout << ans << "\n"; }