Work statistics in quantum quenches in the Heisenberg XY model