What is the log-likelihood for the problem? 
We sample $x_1, \ldots ,x_n$ as follows: First, we draw from the set of $5$ bit binary strings $\{z_0,\ldots,z_{31}\}$ with probability $p_r$ for $z_r$. Then, we mask two bits of the chosen number to get our sample $x_i$ - we choose the mask uniformly at random. Hence, each mask has the probabiltiy ${{5}\choose{2}} = 0.1$ to be chosen.
What is the log-likelihood of the parameters $p_r$ given the data $x_1,\ldots, x_n$?

here's what I did:
We notice that given a masked number, it has exactly $4$ possible sources. I denoted it as $s_{ij}$.
$$\sum_{i=0}^{31}\log p\left(X_{i}=x_{i};\theta\right) = \sum_{i=0}^{31}\log\left(\sum_{j=1}^{4}P\left(X_{i}=x_{i}\mid S_{i}=s_{ij}\right)\cdot P\left(S_{i}=s_{ij}\right)\right) = \sum_{i=0}^{31}\log\left(\sum_{j=1}^{4}P\left(X_{i}=x_{i}\mid S_{i}=s_{ij}\right)\cdot p_{r}\right) = \sum_{i=0}^{31}\log\left(\sum_{j=1}^{4}0.1\cdot p_{r}\right) = \sum_{i=0}^{31}\log\left(0.4\cdot p_{r}\right)$$
Is that correct?
 A: Let $x$ denote a masked sequence with exactly two entries masked by the value $2$ (as in the comment). So that is, $x \in \mathcal{M} \subset \{0,1,2\}^5$ where
$$\mathcal{M} \, \colon = \left\{ x \in \{0,1,2\}^{5} \, \colon \, \sum_{i=1}^5 \mathbf{1}{(x_i = 2)} = 2 \right\},$$
and $\mathbf{1}$ denotes the indicator function.
Given $x \in \mathcal{M}$, we define the set $Z_x \subset \{0,1\}^5$ to be the set of unmasked vectors that project onto $x$ when masked. That is
$$
Z(x) \, \colon = \{z \in \{0,1\}^5 \, \colon \, z_i = x_i, \,\, \forall \, i \, \text{st. } x_i \neq 2\}.
$$
Lt $p$ denote a probability distribution on  $\{0,1\}^5$, with $\mathbf{P}(Z = z) = p_z$. Assuming that $Z$ is independent of the points chosen to be masked then we have
\begin{align*}
\mathbf{P}(x) & = \sum_{z \in \{0,1\}^5} \mathbf{P}(x \, | \, z) \mathbf{P}(z) \\
& = \sum_{z \in \{0,1\}^5} \binom{5}{2}^{-1} \mathbf{1}( z \in Z_x)\mathbf{P}(z) \\
& = \frac1{10} \sum_{z \in Z(x)} p_z \\
\end{align*}
where in the second line we noted that if $z \not \in Z(x)$ then $P(x \, | \, z) = 0$, whereas conditioned on $z \in Z(x)$, the probability of the masked sequence being $x$ is uniform amongst the $\binom{5}{2} = 10$ possibilities.
Therefore, as a statement about likelihoods: given that we have observed $x$, the log-likelihood that this came from distribution $p$ is given by
$$\log L(p\, | \, x) = -\log 10 + \log \sum_{z \in Z(x)} p_z. $$
And given $n$ independent observations $x_1,\ldots, x_n$ this becomes
$$\log L(p\, | \, x_1,\ldots,x_n) = -n \log 10 + \sum_{i=1}^n \log \sum_{z \in Z(x_i)} p_z. $$
