Implement recursive rectangle count.