Dynamically determine the number of input channels.