The mass function and average mass-loss rate of dark matter subhaloes