A regular polygon has an exterior angle of 40 degrees. How many sides does it have?