Each exterior angle of a certain regular polygon measures 30. How many sides does the polygon have?