The methods of statistical mechanics are applied to two-dimensional foams under macroscopic agitation. A new variable -- the total cell curvature -- is introduced, which plays the role of energy in conventional statistical thermodynamics. The probability distribution of the number of sides for a cell of given area is derived. This expression allows to correlate the distribution of sides (topological disorder) to the distribution of sizes (geometrical disorder) in a foam. The model predictions agree well with available experimental data.