Editorial for Count the squares

plz someone provide the Editorial for this problem

http://www.codechef.com/problems/D6