The number of sides of each interior angle of a regular polygon is 36 less than 8 times the measure of each exterior angle. Find the number of sides of the polygon.