From a standard 8x8 chessboard the squares
a1 and g8 were removed.
Evaluate the total numbers of squares created
by the horizontal and vertical lines of the distorted chessboard.
Count all possible sizes from 1x1 to 7x7.
The number of squares in the pristine chessboard is the sum of the first 8 perfect squares: 204.
The squares which contain a1 are just the squares anchored in that corner: 8.
The squares which contain g8 are the squares that have g8 as a corner when ignoring column h; plus size 2 or larger squares that have h8 as a corner: 7+7=14.
The number of squares which contain both a1 and g8 is the full 8x8 square: 1. This square is counted in both the a1 and g8 subtotals.
Then the total number of squares can be counted as the set of all squares minus those that have a1 or g8: 204 - (8 + 14 - 1) = 183.