The number of polynomial solutions of polynomial Riccati equations