[Solution by Dr. Abubacker] First digit $5,6,7$; last digit with sum $\le8$: first $5$: $0$-$3$ ($4$); first $6$: $0$-$2$ ($3$); first $7$: $0,1$ ($2$). Total $9$ choices for the ends and $8^3=512$ for the middle: $4608$. The number $50000$ is not greater than $50000$, so subtract $1$: $4607$. Answer (4).