A variational principle for the equilibrium of hard sphere systems