You get different methods -
FIFO
LIFO
AVCO
I use AVerage COst, but for all 3 in your scenario work out the same.
Even though you sold 20 shares for a quid, all you have done is realise a loss of £20, the other shares you still hold, still cost you £2 each, they didn’t become more expensive as the price you paid was the price at the time.