Various Cost Basis Overall Gain Wash Sell

If sell a stock with various cost basis. some result in a loss but overall is a gain.  Is it subject to wash sell?

 

Multiple purchases at various prices.

Sell all at once for overall gain.  But some of the shares were underwater.

Since this is an overall gain, are the shares that were underwater subject to wash sell?