How do I determine the cost basis of numerous shares of xyz corp purchase over several years when they are sold?

Determining the cost basis of stock

I had 5900 shares of stock  purchased over an eight year period

 

Last November I sold shares of 426 shares of xyz corp. @194

 

The shares had been purchase at various dates in 2017 & 2018 and 2022 at various prices ($168, $174 & $194).

 

The consolidated tax statement I was sent by my brokerage account shows

 

$82438 for box 1d proceeds

 

$20425 for box 1e cost basis

 

How do brokerage firms determine  the cost basis of these shares when the shares I originally were purchased at different times over the years?