def grover_diffuser(circuit, n_qubits):
    """Applies the grover diffuser on the first n qubits in circuit"""
    qubit_indices = [i for i in range(n_qubits)]

    #  -----------Diffuser Protocol
    # Apply transformation |s> -> |00..0> (H-gates)
    circuit.h(qubit_indices)
        # Apply transformation |00..0> -> |11..1> (X-gates)
    circuit.x(qubit_indices)
        # Do multi-controlled-Z gate
    circuit.h([-1])
    circuit.mct(qubit_indices[:-1], [-1])  # multi-controlled-toffoli
    circuit.h([-1])
        # Apply transformation |11..1> -> |00..0>
    circuit.x(qubit_indices)
        # Apply transformation |00..0> -> |s>
    circuit.h(qubit_indices)
    
    return circuit