  We report a theoretical study of ac response of superconducting quantum
metamaterials (SQMs), i.e. an array of qubits (two-levels system) embedded in
the low-dissipative resonator. By making use of a particular example of SQM,
namely the array of charge qubits capacitively coupled to the resonator, we
obtain a second-order phase transition between an incoherent (the
high-temperature phase) and coherent (the low-temperatures phase) states of
photons. This phase transition in many aspects resembles the
paramagnetic-ferromagnetic phase transition. The critical temperature of the
phase transition, $T^\star$, is determined by the energy splitting of two-level
systems $\delta$, number of qubits in the array $N$, and the strength of the
interaction $\eta$ between qubits and photons in the cavity. We obtain that the
photon states manifest themselves by resonant drops in the frequency dependent
transmission $D(\omega)$ of electromagnetic waves propagating through a
transmission line weakly coupled to the SQM. At high temperatures the
$D(\omega)$ displays a single resonant drop, and at low temperatures a peculiar
\emph{double resonance response} has to be observed. The physical origin of
such a resonant splitting is the quantum oscillations between two coherent
states of photons of different polarizations.
