Relationship between the number of rectangles and the perimeter