Algorithm for determining variety

Hey guys, it’s been awhile,

I’m wondering if anybody has any ideas about an algorithm to see how many different variations there are within a set of data… For example, if I had:

1 1 1 1 2 3 3 2 1 1 4

The algorithm could figure that there are 4 different “types”. I don’t mean 4 numbers, because there are obviously more, but 4 varieties; of course, if I could be given a couple of hints as to how to go about count how many of the different types, that’d be appreciated, too. Thanks in advance.