Correlation between the densities of X-ray sources and interstellar gas