This is a little custom so I will not be able to work it out entirely for you but I think you could create an array, then loop over the items in the cart, when you are looping you can check the current option to see if it unique by seeing if it is not in your newly created array. If it is not in the array then you add it to the array. In the end you should have an array that has only unique values. You can then do a count on this array. Here is a code example of what I'm talking about:
$unique_riders = array();
for($e = 0; $e < sizeof($your_cart->items); $e++){
if(!(in_array($your_cart->items[$e]->rider, $unique_riders))){
$unique_riders[$e] = $your_cart->items[$e]->rider;
}
}
$riders = count($unique_riders);
This is just a pseudo code example based on your post, it might have errors and need some tweaking to be able to use but I think this is the rite approach for this.