Solution:
There can be 5 types of squares thus formed.
Case I: Single square boxes
Single square boxes along a horizontal row = 5
Single square boxes along a vertical row = 5
Number of single square boxes = 5×5=25
Case II: Double square boxes
Double square boxes along horizontal × vertical = 4×4=16
Case III: Triple square boxes = 3×3=9
Case IV: Squares with 4 square boxes = 2×2=4
Case V: Squares with 5 square boxes = 1×1=1
∴ Total number of squares =
25 + 16 + 9 + 4 + 1 = 55