Here is how you can do it. Find the opening of the repeated region that will look like:
<?php do { ?>
Change it to:
<?php $horseNumber=0; ?>
<?php do { ?>
<?php $horseNumber++; ?>
Then inside the loop you can show the count before the horse name with:
<?php echo($horseNumber); ?>