Ideal systems do not significantly interact. When you turn on interactions, the statistics become much more complicated. For weakly interacting gases, the partition function becomes a product of the ideal partition function and the configuration integral. If you make the assumption that the potential energy of the gas can be written as a sum of interactions between pairs of molecules, then you define a quantity called the mayer function which is a measure of the deviation of each boltzmann factor: f_ij = exp(-b*u_ij) - 1, so that when you substitute this into the configuration integral, you get a sum of integrals of pairs, distinct pairs, etc leading to a pertubative series with each term representing an increase in complexity of the interactions, like one molecule, two molcules interacting, three molecules interacting, and so on.

You've already seen this in p-chem under the guise of virial coefficients.