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

public class wires_aa implements Runnable {

	public static void main(String[] args) {
		new Thread(new wires_aa()).start();
	}

	BufferedReader br;

	StringTokenizer st;

	PrintWriter out;

	boolean eof = false;

	Random rand = new Random(this.hashCode());

	public void run() {
		Locale.setDefault(Locale.US);
		try {
			br = new BufferedReader(new FileReader(FNAME + ".in"));
			out = new PrintWriter(FNAME + ".out");
			solve();
			out.close();
		} catch (Throwable e) {
			e.printStackTrace();
			System.exit(566);
		}
	}

	String nextToken() {
		while (st == null || !st.hasMoreTokens()) {
			try {
				st = new StringTokenizer(br.readLine());
			} catch (Exception e) {
				eof = true;
				return "0";
			}
		}
		return st.nextToken();
	}

	int nextInt() {
		return Integer.parseInt(nextToken());
	}

	String FNAME = "wires";

	void MyAssert(boolean u, String message) {
		if (!u) {
			throw new Error("Assertion failed!!! " + message);
		}
	}

	void inBounds(long x, long l, long r, String name) {
		MyAssert(l <= x && x <= r, name + " is not in bounds!!! " + x
				+ " is not in [" + l + ", " + r + "]");
	}

	private void solve() throws IOException {
		int n = nextInt();
		inBounds(n, 1, 1000, "n");
		int[] a = new int[n];
		for (int i = 0; i < a.length; i++) {
			a[i] = nextInt();
			inBounds(a[i], 0, 100000, "a[" + i + "]");
		}
		Arrays.sort(a);
		int[] b = new int[n];
		for (int i = 0; i < b.length; i++) {
			b[i] = nextInt();
			inBounds(b[i], 0, 100000, "b[" + i + "]");
		}
		Arrays.sort(b);
		for (int i = 1; i < a.length; i++) {
			MyAssert(a[i] != a[i - 1], "There are same elements!!! " + a[i]);
		}
		for (int i = 1; i < b.length; i++) {
			MyAssert(b[i] != b[i - 1], "There are same elements!!! " + b[i]);
		}
		int j = 0;
		for (int i = 0; i < b.length; i++) {
			while (j < a.length && a[j] < b[i]) {
				j++;
			}
			if (j < a.length) {
				MyAssert(a[j] != b[i], "There are same elements!!! " + b[i]);
			}
		}
		long ans = 0;
		for (int i = 0; i < b.length; i++) {
			ans = ans + Math.abs(a[i] - b[i]);
		}
		out.println(ans);
	}

}
