# [Brachylog], 18 bytes

    {hl⟦kp;?z₀∋₍ᵐ+}ᶠot

[Try it online!][TIO-jpsfbzsm]

[Brachylog]: https://github.com/JCumin/Brachylog
[TIO-jpsfbzsm]: https://tio.run/##SypKTM6ozMlPN/r/vzoj59H8ZdkF1vZVj5oaHnV0P2rqfbh1gnbtw20L8kv@/4@ONtRRMNJRMNZRMInVUYg2BdJgnhGIZwaWM9dRMIyN/R8FAA "Brachylog – Try It Online"


###Explanation

                    ot      The output is the biggest result of…
    {             }ᶠ        …finding all outputs to the following predicate:
     hl⟦k                     Construct the range [0, …, n-1]
         p                    Take a permutation of that range
          ;?z₀                Zip that permutation with the Input, stopping when all elements of
                                the input are used (important because the range is possibly
                                bigger than the length of the input)
              ∋₍ᵐ             In each element of the zip, take the head'th element of the tail
                 +            Sum the result