import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner sc =new Scanner(System.in);
		int N = sc.nextInt();

		int[] V = new int[N];
		int[] C = new int[N];

		for (int i = 0; i < C.length; i++) {
			C[i] = sc.nextInt();
		}

		for (int i = 0; i < V.length; i++) {
			V[i] = sc.nextInt();
		}

		int max = 0;
		for (int i = 0; i < (1<<N); i++) {
			int Xsum = 0;
			int Ysum = 0;
			for (int j = 0; j < N; j++) {
				if (((i>>j) & 1)==1) {
					//合致
					Xsum += C[j];
					Ysum += V[j];
				}
			}
			if (Xsum-Ysum >= max) {
				max = Xsum-Ysum;
			}
		}

		System.out.println(max);

		sc.close();
	}

} import java.util.*; util.* java public class Main {

	public static void main(String[] args) {
		Scanner sc =new Scanner(System.in);
		int N = sc.nextInt();

		int[] V = new int[N];
		int[] C = new int[N];

		for (int i = 0; i < C.length; i++) {
			C[i] = sc.nextInt();
		}

		for (int i = 0; i < V.length; i++) {
			V[i] = sc.nextInt();
		}

		int max = 0;
		for (int i = 0; i < (1<<N); i++) {
			int Xsum = 0;
			int Ysum = 0;
			for (int j = 0; j < N; j++) {
				if (((i>>j) & 1)==1) {
					//合致
					Xsum += C[j];
					Ysum += V[j];
				}
			}
			if (Xsum-Ysum >= max) {
				max = Xsum-Ysum;
			}
		}

		System.out.println(max);

		sc.close();
	}

} Main public static void main(String[] args) {
		Scanner sc =new Scanner(System.in);
		int N = sc.nextInt();

		int[] V = new int[N];
		int[] C = new int[N];

		for (int i = 0; i < C.length; i++) {
			C[i] = sc.nextInt();
		}

		for (int i = 0; i < V.length; i++) {
			V[i] = sc.nextInt();
		}

		int max = 0;
		for (int i = 0; i < (1<<N); i++) {
			int Xsum = 0;
			int Ysum = 0;
			for (int j = 0; j < N; j++) {
				if (((i>>j) & 1)==1) {
					//合致
					Xsum += C[j];
					Ysum += V[j];
				}
			}
			if (Xsum-Ysum >= max) {
				max = Xsum-Ysum;
			}
		}

		System.out.println(max);

		sc.close();
	} main {
		Scanner sc =new Scanner(System.in);
		int N = sc.nextInt();

		int[] V = new int[N];
		int[] C = new int[N];

		for (int i = 0; i < C.length; i++) {
			C[i] = sc.nextInt();
		}

		for (int i = 0; i < V.length; i++) {
			V[i] = sc.nextInt();
		}

		int max = 0;
		for (int i = 0; i < (1<<N); i++) {
			int Xsum = 0;
			int Ysum = 0;
			for (int j = 0; j < N; j++) {
				if (((i>>j) & 1)==1) {
					//合致
					Xsum += C[j];
					Ysum += V[j];
				}
			}
			if (Xsum-Ysum >= max) {
				max = Xsum-Ysum;
			}
		}

		System.out.println(max);

		sc.close();
	} Scanner sc =new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int[] V = new int[N]; V new int[N] N int[] C = new int[N]; C new int[N] N for (int i = 0; i < C.length; i++) {
			C[i] = sc.nextInt();
		} int i = 0; int i = 0; i 0 i < C.length i C.length C C.length i++ i++ i {
			C[i] = sc.nextInt();
		} {
			C[i] = sc.nextInt();
		} C[i] = sc.nextInt() C[i] C i sc.nextInt() sc.nextInt sc for (int i = 0; i < V.length; i++) {
			V[i] = sc.nextInt();
		} int i = 0; int i = 0; i 0 i < V.length i V.length V V.length i++ i++ i {
			V[i] = sc.nextInt();
		} {
			V[i] = sc.nextInt();
		} V[i] = sc.nextInt() V[i] V i sc.nextInt() sc.nextInt sc int max = 0; max 0 for (int i = 0; i < (1<<N); i++) {
			int Xsum = 0;
			int Ysum = 0;
			for (int j = 0; j < N; j++) {
				if (((i>>j) & 1)==1) {
					//合致
					Xsum += C[j];
					Ysum += V[j];
				}
			}
			if (Xsum-Ysum >= max) {
				max = Xsum-Ysum;
			}
		} int i = 0; int i = 0; i 0 i < (1<<N) i (1<<N) 1 N i++ i++ i {
			int Xsum = 0;
			int Ysum = 0;
			for (int j = 0; j < N; j++) {
				if (((i>>j) & 1)==1) {
					//合致
					Xsum += C[j];
					Ysum += V[j];
				}
			}
			if (Xsum-Ysum >= max) {
				max = Xsum-Ysum;
			}
		} {
			int Xsum = 0;
			int Ysum = 0;
			for (int j = 0; j < N; j++) {
				if (((i>>j) & 1)==1) {
					//合致
					Xsum += C[j];
					Ysum += V[j];
				}
			}
			if (Xsum-Ysum >= max) {
				max = Xsum-Ysum;
			}
		} int Xsum = 0; Xsum 0 int Ysum = 0; Ysum 0 for (int j = 0; j < N; j++) {
				if (((i>>j) & 1)==1) {
					//合致
					Xsum += C[j];
					Ysum += V[j];
				}
			} int j = 0; int j = 0; j 0 j < N j N j++ j++ j {
				if (((i>>j) & 1)==1) {
					//合致
					Xsum += C[j];
					Ysum += V[j];
				}
			} {
				if (((i>>j) & 1)==1) {
					//合致
					Xsum += C[j];
					Ysum += V[j];
				}
			} if (((i>>j) & 1)==1) {
					//合致
					Xsum += C[j];
					Ysum += V[j];
				} ((i>>j) & 1)==1 ((i>>j) & 1) (i>>j) i j 1 1 {
					//合致
					Xsum += C[j];
					Ysum += V[j];
				} Xsum += C[j] Xsum C[j] C j Ysum += V[j] Ysum V[j] V j if (Xsum-Ysum >= max) {
				max = Xsum-Ysum;
			} Xsum-Ysum >= max Xsum-Ysum Xsum Ysum max {
				max = Xsum-Ysum;
			} max = Xsum-Ysum max Xsum-Ysum Xsum Ysum System.out.println(max) System.out.println System.out System System.out max sc.close() sc.close sc String[] args args public class Main {

	public static void main(String[] args) {
		Scanner sc =new Scanner(System.in);
		int N = sc.nextInt();

		int[] V = new int[N];
		int[] C = new int[N];

		for (int i = 0; i < C.length; i++) {
			C[i] = sc.nextInt();
		}

		for (int i = 0; i < V.length; i++) {
			V[i] = sc.nextInt();
		}

		int max = 0;
		for (int i = 0; i < (1<<N); i++) {
			int Xsum = 0;
			int Ysum = 0;
			for (int j = 0; j < N; j++) {
				if (((i>>j) & 1)==1) {
					//合致
					Xsum += C[j];
					Ysum += V[j];
				}
			}
			if (Xsum-Ysum >= max) {
				max = Xsum-Ysum;
			}
		}

		System.out.println(max);

		sc.close();
	}

} public class Main {

	public static void main(String[] args) {
		Scanner sc =new Scanner(System.in);
		int N = sc.nextInt();

		int[] V = new int[N];
		int[] C = new int[N];

		for (int i = 0; i < C.length; i++) {
			C[i] = sc.nextInt();
		}

		for (int i = 0; i < V.length; i++) {
			V[i] = sc.nextInt();
		}

		int max = 0;
		for (int i = 0; i < (1<<N); i++) {
			int Xsum = 0;
			int Ysum = 0;
			for (int j = 0; j < N; j++) {
				if (((i>>j) & 1)==1) {
					//合致
					Xsum += C[j];
					Ysum += V[j];
				}
			}
			if (Xsum-Ysum >= max) {
				max = Xsum-Ysum;
			}
		}

		System.out.println(max);

		sc.close();
	}

} Main
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner sc =new Scanner(System.in);
		int N = sc.nextInt();

		int[] V = new int[N];
		int[] C = new int[N];

		for (int i = 0; i < C.length; i++) {
			C[i] = sc.nextInt();
		}

		for (int i = 0; i < V.length; i++) {
			V[i] = sc.nextInt();
		}

		int max = 0;
		for (int i = 0; i < (1<<N); i++) {
			int Xsum = 0;
			int Ysum = 0;
			for (int j = 0; j < N; j++) {
				if (((i>>j) & 1)==1) {
					//合致
					Xsum += C[j];
					Ysum += V[j];
				}
			}
			if (Xsum-Ysum >= max) {
				max = Xsum-Ysum;
			}
		}

		System.out.println(max);

		sc.close();
	}

}
