I have $n$ qubits in superposition. I want to add a negative phase to all states with more than $m$ $1$s, e.g. for $n=3$ qubits and $m=1$ I want to get:
$\frac{1}{\sqrt{N}}(|000\rangle + |001\rangle + |010\rangle - |011\rangle + |100\rangle - |101\rangle - |110\rangle - |101\rangle - |111\rangle)$
I know that I can use CZ gate to add the negative phase, but if I have many qubits do I need to add CZ, C2Z, C3Z to cover any possible state? That would be $O(2^n)$ in the number of gates.