# Construct a orale for XOR

I am trying to construct an oracle which should accept 10 or 01 (i.e. $$|1\rangle$$ should be returned for these input). In the below picture the oracle is between the barrier and after the barrier we have Grover. But something is wrong. After the measurement I get as a result {'10': 260, '01': 248, '00': 274, '11': 242}. I tried to simulate on IBM Q. I realized that input states $$|01\rangle$$ and $$|10\rangle$$ have oposite phase in comparison with others. This is desired behavior of the algorithm because these states have to be marked. Phase of other two states is intact. Because two states are marked and two do not, average amplitude is zero. When you rotate amplitudes around average (the zero), two states have amplitude say $$a$$ and two $$-a$$. When you calculate probabilites based on the amplitudes, you get same probabilities for all input states because $$a^2 = (-a)^2$$.
However, if you mark only one state, for example $$|11\rangle$$ (e.g. Toffoli gate is the oracle), the algorithm behave as desired since average of amplitudes after marking $$|11\rangle$$ is not zero.