method :
Observe that each square of side r can have exactly r-1 diff squares inscribed inside it .
So evidently in the region occupied by a rXr sqr , r sqrs are present .
we know no of rXr regions = (n+1-r)2
so ans is
Σ(n+1-r)2 .r which can be calculated