Used recursive functions to get the number of sides.