We consider two separate atoms interacting with a single-mode optical or microwave resonator. When the frequency of the resonator field is twice the atomic transition frequency, we show that there exists a resonant coupling between one photon and two atoms, via intermediate virtual states connected by counterrotating processes. If the resonator is prepared in its one-photon state, the photon can be jointly absorbed by the two atoms in their ground state which will both reach their excited state with a probability close to one. Like ordinary quantum Rabi oscillations, this process is coherent and reversible, so that two atoms in their excited state will undergo a downward transition jointly emitting a single cavity photon. This joint absorption and emission process can also occur with three atoms. The parameters used to investigate this process correspond to experimentally demonstrated values in circuit quantum electrodynamics systems.