Suppose $X_1,\ldots, X_n$ are i.i.d. random variables having pdf $$ f_{\theta}(x)=\left\{\begin{array}{ll}{\theta,} & {0 \leqslant x \leqslant 1} \\ {1-\theta,} & {1<x \leqslant 2}\end{array}\right. $$ Give the maximum likelihood estimate of $\theta$.
I know the likelihood function of $(X_1,\ldots, X_n)$ is $$\ell(\theta;x)=\prod_{i=1}^{n}\left[\theta I(0<x_i<1)+(1-\theta)I(1<x_i<2)\right]$$ But I don't know how to compute $\frac{\partial \log \ell(\theta)}{\partial \theta}=0$ to get $\hat{\theta}$.
Is there anyone can tell me?