import java.io.*; import java.util.*; import java.util.function.*; import java.util.stream.*; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(); int n = sc.nextInt(); Product[] products = new Product[n * 2]; for (int i = 0; i < n * 2; i++) { products[i] = new Product(sc.nextInt()); } for (int i = 0; i < n * 2; i++) { products[i].mma = sc.nextInt(); } Arrays.sort(products); long ans = 0; for (int i = 0; i < n * 2; i++) { ans += (i % 2 == 0 ? products[i].general: -products[i].mma); } System.out.println(ans); } static class Product implements Comparable { int general; int mma; public Product(int general) { this.general = general; } public int diff() { return general + mma; } public int compareTo(Product another) { return Integer.compare(diff(), another.diff()); } } } class Scanner { BufferedReader br; StringTokenizer st = new StringTokenizer(""); public Scanner() { try { br = new BufferedReader(new InputStreamReader(System.in)); } catch (Exception e) { } } public int nextInt() { return Integer.parseInt(next()); } public long nextLong() { return Long.parseLong(next()); } public double nextDouble() { return Double.parseDouble(next()); } public String next() { try { while (!st.hasMoreTokens()) { st = new StringTokenizer(br.readLine()); } } catch (Exception e) { e.printStackTrace(); } finally { return st.nextToken(); } } }