How many squares

How many squares can you make on the following 5 x 5 grid of dots, such that all four corners of the square lie on a dot?

Hint: The answer is not 30!

Solution