let () =
	Scanf.scanf "%d\n" @@ fun n ->
    let arr = Array.init n @@ fun _ -> Scanf.scanf "%d " @@ fun d -> d in
    let () = Array.fast_sort compare arr in
    Printf.printf "%d\n" ((Array.fold_left (+) 0 arr) - arr.(0))