Each of two regular polygons $P$ and $Q$ was divided by a line into two parts. One part of $P$ was attached to one part of $Q$ along the dividing line so that the resulting polygon was regular and not congruent to $P$ or $Q$. How many sides can it have?