The maximum possible number of phases that can coexist in equilibrium (closed system) was a problem that Gibbs spent several years working on. In fact, he is said to have invented the Gibbs function and the chemical potential in order to solve this problem, a result we now know as the Gibbs phase rule.
From thermal and material equilibrium arguments, we can arrive, as Gibbs did, at the result F= C - P + 2, where F is the number of independent intensive variables, C is the number of components (chemically independent entities) and P is the number of phases present. For example, in a system in which we have neon in the gas phase, we can immediately write C=1 [Ne] and P=1 [gas], hence F=2. This means we have two intensive variables, usually T and P, which can be independently varied within the gas phase.
As soon as another phase appears at equilibrium, the number of degrees of freedom goes down. For example, if neon were to condense we would now have P=2 [gas, liquid] leading to F=1: we can independently vary either T or P and the other will adjust in order to stay at equilibrium.
When two or more of our substances are tethered together in a chemical equilibrium, we get an additional restriction. We often use the relation C = S - R account for this reduction in the number of components.
Several interesting applications of the phase rule can be found in geochemistry, biophysics and nuclear chemistry.