DFA or NFA Construction
You only have a limited number of states to worry about:

Let note them $Q_{i,j}$ where $i \in \{0,1,2,3,4\}$ is the number of 0 and $j \in \{0,1,2,3,4\}$ is the number of 1; each up to a max of 4 $\implies$ only 25 states.

Then the transition is
$\delta(Q_{i,j}, 0) = Q_{i+1,j}$ if $i&lt;4$
$\delta(Q_{4,j}, 0) = Q_{4,j}$
$\delta(Q_{i,j}, 1) =Q_{i,j+1}$ if $j&lt;4$
$\delta(Q_{i,4}, 1) =Q_{i,4}$ 

Then the starting state is $Q_{0,0}$ and the accepting states are all $Q_{i,j}$ with $i=0 \oplus j = 1$ (where $\oplus$ is the xor operator).