Sorting using count, grep and count

Hi,

I trying to sort information in a file by making count for every object. For example:
A
B
A
D
A
B
C

i would like to sort out count for each object (A's, B's and etc) but in actual case i dont know the object but i know the position ofthe object. do i need to use array as well? Any help would be great.

check if this is what you want:

sort filename | uniq -c

Show how the output should look like for a given input sample.