You can do this with two format contitions. Select A2 and set these formulas (and formats)
=MOD(SUMPRODUCT(--((INDEX($A:$A,1,1):INDEX($A:$A,ROW(A1),1))<>(INDEX($A:$A,2,1):INDEX($A:$A,ROW(A2),1)))),2)=0
and
=MOD(SUMPRODUCT(--((INDEX($A:$A,1,1):INDEX($A:$A,ROW(A1),1))<>(INDEX($A:$A,2,1):INDEX($A:$A,ROW(A2),1)))),2)=1
Format the colors appropriatly, these formula error in A1, so A1 should have a "natural" format the same as the =0 condition.