Find the number of squares in the given picture.

40
There are 40 squares in this picture.
Let us denote the size of squares from smaller to larger by S1, S2, S3, S4 and S5.
No. of S1 = 8
No. of S2 = 16 + 2 middle ones = 18
No. of S3 = 9
No. of S4 = 4
No. of S5 = 1