How to power with 24V arduino Mega based board


I am developing a board based on the ArduinoMega2560 and I need to power it with 24VDC. I thought I could replace the boards' voltage regulator LD1117S50CTR for another that allows me to plug 24 into it, but the Arduino schematic is not using the recommended application circuit on the datasheet. So I thought that I could just use another voltage regulator to reduce it to 12V first and connect that to the Arduino's voltage regulator. Would that be ok or would I be losing too much power? Is there any calculation I have to make so I can replace the boards' voltage regulator since the output capacitances are different from the datasheets circuit? I tried to count how many capacitors were connected between 5V and GND but still, they don't add up to 10uF.

I will attach snippets of the Arduino schematic, the circuit on the datasheet, the circuit I want to implement, the LD1117S50CTR datasheet, and also the Arduino schematic in pdf.

Thanks in advance.

ld1117 schematic.pdf (1.45 MB)

MEGA2560_Rev3e_sch.pdf (102 KB)

Get a step-down converter from 24V to 5V, or to 7V if you want to use the on-board regulator for fine tuning.