Let's assign a value of 1 to competitive programmers and 0 to politicians. Then it's easy to see, that the query simply returns bitwise XOR of the values of X, Y, Z.
So, we have the following problem: n≥5 binary values $x_1, x_2,