Number of elements of order d in a finite group