A replica approach to glassy hard spheres