You need only two hyperplanes to solve this. Thus you need two neurons in the hidden layer. You can use two or four neurons in the output layer. Both options result in the correct solution (theoretically). You can use perceptrons.