Add variable to store the number of valid squares