I have a list of tuples like

(A, 1), (B, 2), (C, 3), (A, 9), (B, 8).

How to get the mean of each value referred to the first element of the tuples, not knowing the number of occurrences of the first element of tuples?

I want something like:

(A, 5), (B, 5), (C, 3).