If you pay attention it’s not so hard. You just have to count the squares in a logic order. We start with the smallest and go up to the bigger ones.

8 small square (0.5x)

18 normal square (1x)

9 square of 2x size

4 squares of 3x size

1 square of 4x size

If you sum this up you will get a total of 40 squares. Was it hard?