How can I hookup 24 Xbox One controllers on my PC? What is the limit?

XInput is limited to a maximum of four controllers:

The XInput API supports up to four controllers connected at any time. The XInput functions all require a dwUserIndex parameter that is passed in to identify the controller being set or queried. This ID will be in the range of 0-3 and is set automatically by XInput. The number corresponds to the port that the controller is plugged into, and is not modifiable.

https://docs.microsoft.com/en-us/windows/win32/xinput/getting-started-with-xinput#multiple-controllers

It's part of the API, anything that relies on XInput will have the same limitation. Most virtual gamepad tools work by simulating an XInput device, which will still count toward this limit.

Another issue is that Bluetooth supports at most 7 peripherals connected to a single receiver. You could get around this by connecting multiple receivers, but I'd recommend using USB connections to avoid interference.

If you have 8+ non-XInput USB controllers and a game that supports DirectInput, you should be able to use all controllers at once. You can mix XInput and DirectInput as long as the game supports both.