Galaxy number counts — V. Ultradeep counts: the Herschel and Hubble Deep Fields