import java.io.*;
import java.util.*;

/**
 * @author Roman V Satyukov
 */
public class wires_rs implements Runnable {
	private final String problemID = getClass().getName().split("_")[0].toLowerCase();
	private BufferedReader in;
	private PrintWriter out;
	
	private void check(boolean expr, String message) {
		if (!expr) {
			throw new AssertionError(message);
		}
	}
	
	private void solve() throws IOException {
		int n = Integer.parseInt(in.readLine());
		check((1 <= n) && (n <= 1000), "n is not in [1..1000]");
		int[] sockets = new int[n + n];
		StringTokenizer st = new StringTokenizer(in.readLine());
		int answer = 0;
		for (int i = 0; i < n; i++) {
			int x = Integer.parseInt(st.nextToken());
			check((0 <= x) && (x <= 100000), "Some of x[i] is not in [0..100,000]");
			sockets[i] = 2 * x;
			answer -= x;
		}
		st = new StringTokenizer(in.readLine());
		for (int i = 0; i < n; i++) {
			int x = Integer.parseInt(st.nextToken());
			check((0 <= x) && (x <= 100000), "Some of x[i] is not in [0..100,000]");
			sockets[n + i] = 2 * x + 1;
			answer += x;
		}
		Arrays.sort(sockets);
		for (int i = 0; i + 1 < sockets.length; i++) {
			check(sockets[i] / 2 != sockets[i + 1] / 2, "Positions of some sockets coincide");
		}
		int balance = 0;
		for (int i = 0; i < sockets.length; i++) {
			if (sockets[i] % 2 == 0) {
				balance++;
			} else {
				balance--;
			}
			check(balance >= 0, "Unbalanced sequence");
		}
		out.println(answer);
	}
	
	public static void main(String[] args) {
		new Thread(new wires_rs()).start();
	}

	public void run() {
		try {
			in = new BufferedReader(new FileReader(new File(problemID + ".in")));
			out = new PrintWriter(new File(problemID + ".out"));
			solve();
			in.close();
			out.close();
		} catch (IOException e) {
			e.printStackTrace();
			System.exit(1);
		}
	}
}
