Sorry I have not made the description!

Outline:

1. A square in the chess-board has 3 properties: the queen in it, can be attacked by how many black queen and how may white ones.

2. We put the black queens and white queens consecutively by using a variable Next to control (if Next is divisible by 2, black goes; else white goes)

3. If the number of white queens equal to the number of black queens and that number is greater than max (max is first assigned as 0) then max is that number.