How many addresses can be in input and output of a transaction
Every transaction output locks funds to one specific output script. These scripts can have various spending conditions such as for example requiring a signature of one specific private key (P2KH, P2KH, P2TR key path spend) or fulfillment of an arbitrary script defined by the recipient (P2SH, P2WSH, P2TR script path spend).
A common script used in the latter category is 2-of-3 multisig, but it would be incorrect to describe this as &quot;2 addresses being funded in one output&quot;. Either way, that would be not the limit.
So, tbh, I'm a bit confused when you describe that one output can fund two addresses.
If I was misconstruing that and you're asking how many inputs and outputs a transaction can have, the answer is that standard transactions must have at least one input and one output, and otherwise are limited to 400,000 weight units. So, a transaction could have thousands of inputs or outputs.