Statistical physics of dyons and confinement