# How can one impliment Bennett's partial measurement onto a binomial subspace for state distillation?

I'm reading the seminal paper on entanglement distillation by Bennett et. al.

The idea is that Alice and Bob have $$n$$ identical copies of an imperfect (but pure) Bell state. The initial state is therefore:

$$\Psi(A,B) = \prod_{i=1}^n(\cos \theta |0_A0_B \rangle + \sin \theta |1_A1_B \rangle)$$

Naturally, when you expand this out, you'll get $$2^n$$ terms with $$n+1$$ binomial coefficients. The authors state that Alice (or Bob) can perform "an incomplete Von Neuman measurement projecting the state into one of the $$n+1$$ orthogonal subspaces."

For the two qubit case, it's clear that Alice could perform a parity measurement on her qubits to project onto $$\{|0_A0_B\rangle,|1_A1_B\rangle\}$$ or $$\{|0_A1_A\rangle, |1_A0_B\rangle\}$$. My question is, how would you implement such a projection in the $$n$$ qubit case?

Detailed responses are much appreciated.

Alice has to project onto the subspace with some number $$n$$ of $$1$$'s in their state $$\lvert x_1,x_2,\dots,x_N\rangle$$. This can be done by first running a circuit which adds the value of all $$x_i$$s and stores it in an ancilla $$\lvert a\rangle$$. (I.e., this is a classical circuit doing $$a\to a+1$$ controlled by the values of $$x_i$$.) Then, run a classical circuit which checks whether $$a=n$$ and outputs the result on another ancilla $$\lvert b\rangle$$. Then, Alice measures $$\lvert b\rangle$$ in the computational basis. If she gets $$1$$, she has projected onto that subspace.