COUNT THE NUMBER OF RECTANGLES