Relationship between number of rectangles and perimeter