Many-particle effects in resonant inelastic scattering of an X-ray photon by an atom