The key issue for the implementation of a metamaterial is to demonstrate the existence of collective modes corresponding to coherent oscillations of the meta-atoms. Atoms of natural materials interact with electromagnetic fields as quantum two-level systems. Artificial quantum two-level systems can be made, for example, using superconducting nonlinear resonators cooled down to their ground state. Here we perform an experiment in which 20 of these quantum meta-atoms, so-called flux qubits, are embedded into a microwave resonator. We observe the dispersive shift of the resonator frequency imposed by the qubit metamaterial and the collective resonant coupling of eight qubits. The realized prototype represents a mesoscopic limit of naturally occurring spin ensembles and as such we demonstrate the AC-Zeeman shift of a resonant qubit ensemble. The studied system constitutes the implementation of a basic quantum metamaterial in the sense that many artificial atoms are coupled collectively to the quantized mode of a photon field.