That is not how a counting works. It is considered a gain a d the new shares have their cost basis on what you paid.period. on e you sell soea nr lower the cost. If it did are you considering the taxes you will be paying into the new cost.
How many .18 shares must you sell to pay your gains? I know it is in a tax free a count. Some have answers for everything. Also it it is in a tax free account minus a Eorh you will still pay taxes at your rate plus applicable. State and local taxes.