In the decision tree model, one's task is to compute a boolean function f : {0, 1} n → {0, 1} on an input x ∈ {0, 1} n that is accessible via queries to a black box (the black box hides the bits xi). In the quantum case, classical queries and computation are replaced by unitary transformations. A quantum algorithm is exact if it always outputs the correct value of f (in contrast to the standard model of quantum algorithms where the algorithm is allowed to be incorrect with a small probability). The minimum number of queries for an exact quantum algorithm computing the function f is denoted by QE(f ).We consider the following n bit function with 0 ≤ k ≤ l ≤ n:i.e. we want to give the answer 1 only when exactly k or l of the bits xi are 1. We construct a quantum query algorithm for this function and give lower bounds for it, with lower bounds matching the complexity of the algorithm in some cases (and almost matching it in other cases):• For all k, l: max{n − k, l} − 1 ≤ QE(EXACT n k,l ) ≤ max{n − k, l} + 1.