The masses of hydrogen and helium gases in the vessels are equal. This means that the product of the number of molecules and the mass of a molecule must be same for H2 and He gases. Since molecular masses of H2 and He are in the ratio 1:2, their number of molecules nH and nHe in the vessels must be in the reverse ratio, that is, nHnHe=21.