An apparatus comprising: instruction decoder circuitry to decode instructions; and data processing circuitry to selectively apply vector processing operations specified by the instructions to an input data vector comprising a plurality of input data items at respective positions in the input data vector, wherein the instruction decoder circuitry is responsive to a count instruction specifying an input data item to generate control signals to control the data processing circuitry to: perform a count operation to determine a count value indicative of a number of input elements of a subset of elements in the specified input data item which have a value which matches a reference value in a reference element in a reference data item, wherein the data processing circuitry is further responsive to the control signals to perform a plurality of count operations, wherein in each of the plurality of count operations the reference value used is a respective reference value in a respective reference element of a plurality of reference elements in the reference data item, wherein the subset of elements in the specified input data item comprises each input element of the input data item which has an element position in the input data item which is within a range of element positions in the input data item, and wherein the range of element positions is bounded by the respective reference element used in each of the plurality of count operations. instruction decoder circuitry to decode instructions; and data processing circuitry to selectively apply vector processing operations specified by the instructions to an input data vector comprising a plurality of input data items at respective positions in the input data vector, wherein the instruction decoder circuitry is responsive to a count instruction specifying an input data item to generate control signals to control the data processing circuitry to: perform a count operation to determine a count value indicative of a number of input elements of a subset of elements in the specified input data item which have a value which matches a reference value in a reference element in a reference data item, wherein the data processing circuitry is further responsive to the control signals to perform a plurality of count operations, wherein in each of the plurality of count operations the reference value used is a respective reference value in a respective reference element of a plurality of reference elements in the reference data item, wherein the subset of elements in the specified input data item comprises each input element of the input data item which has an element position in the input data item which is within a range of element positions in the input data item, and wherein the range of element positions is bounded by the respective reference element used in each of the plurality of count operations. perform a count operation to determine a count value indicative of a number of input elements of a subset of elements in the specified input data item which have a value which matches a reference value in a reference element in a reference data item, wherein the data processing circuitry is further responsive to the control signals to perform a plurality of count operations, wherein in each of the plurality of count operations the reference value used is a respective reference value in a respective reference element of a plurality of reference elements in the reference data item, wherein the subset of elements in the specified input data item comprises each input element of the input data item which has an element position in the input data item which is within a range of element positions in the input data item, and wherein the range of element positions is bounded by the respective reference element used in each of the plurality of count operations.