Construct a rectangle on one side of a regular quadrilateral. On one non-adjacent side of the rectangle, construct a regular pentagon. Continue this pattern by constructing a regular hexagon on a non-adjacent side of the pentagon, followed by a regular heptagon, and finally, conclude with a nonagon. How many sides does the resulting polygon have?