Finding sequences in array

does anyone have any idea what to do in order to find the number of sequences in an array?

for example:
my array is:

banana, banana, apple, banana, banana.

what shell i do in order to get the numbers: 2,1,2? (2 bananas, 1 apple, 2 bananas).

a short example will be very appreciated!

thanx!