let positive_sum array =
  let rec positive_sum' array i res =
    if i >= Array.length array || array.(i) <= 0 then res
    else positive_sum' array (i + 1) (res + array.(i)) in
  positive_sum' array 0 0
;;

let id = fun x -> x;;

let () = Scanf.scanf " %d" (fun n' ->
  let n = n' in
  let v = Array.init n (fun _ -> Scanf.scanf " %d" id) in
  let c = Array.init n (fun _ -> Scanf.scanf " %d" id) in
  let p = Array.mapi (fun i vi -> vi - c.(i)) v in (
    Array.fast_sort (fun a b -> b - a) p;
    p |> positive_sum |> print_int
));;