import std; void main () { int N = readln.chomp.to!int; auto A = readln.split.to!(int[]); auto B = readln.split.to!(int[]); auto C = new int[](2 * N); foreach (i; 0..2 * N) C[i] = A[i] + B[i]; auto index = iota(2 * N).array; index.sort!((a, b) => C[a] < C[b]); long X = 0, Y = 0; foreach (i, v; index) { if (i % 2 == 0) X += A[v]; if (i % 2 == 1) Y += B[v]; } writeln(X - Y); } void read (T...) (string S, ref T args) { import std.conv : to; import std.array : split; auto buf = S.split; foreach (i, ref arg; args) { arg = buf[i].to!(typeof(arg)); } }