A regular pentagon and a square share a mutual vertex B. The sides AB and BC are sides of a third regular polygon with vertex B. How many sides does this polygon have?