i dont know how to solve this problem,the only way i could think of is marking all the points on or under rectangles and finally counting all marked points.What is the correct way to solve this problem?Thank you.

Tumse na ho paega.
why downwote
Is it an ongoing contest?
no it finished yesterday midnight