You can buy various parcels of shares and then sell any one or more of those parcels or you can sell part of one parcel nd part of another
Been doing it for years both as a trader and as an investor
I repeat, always keep detailed records so that you can prove what particular shares you sold and from which parcel - in your example above it is quite straight forward though
As JP says above; keeping a diary note can be useful to substantiate your trade
JUST DON"T NOTE IT WAS TO GET A CAPITAL LOSS - lol